It sounds like you need a KVM switch. I used switches from Star Tech before and they seem to work well enough. https://www.startech.com/en-us/server-management/kvm-switches
I mention them only because I have used them before and have no real experience with any others. I found out that they are often cheaper if bought through a third party vendor than if bought direct, so shopping around can save money. There's other brands of course, so shop around.
There's some exceptions but for the most part all KVM switches will switch like for like. That is they will have connect to the computers by USB-A, PS/2, or whatever for keyboard and mouse, then connect by HDMI or whatever for video, then have ports to match for connecting the display, keyboard, and mouse.
Whatever the case the first thing to do is decide what ports the keyboard, mouse, display, and whatever else will need. I suspect USB-A and DisplayPort or HDMI. Then comes to finding the adapters for both computers to get to that point. I was able to find a USB-C "microdock" with HDMI, 2x USB-A, USB-C power pass-through, and some other bits, for about $40. An old Macbook with Thunderbolt 2 likely already has those ports, and if not then it's a matter of one or two $10 adapters.
Now that both computers are using the same ports then it's a matter of picking a KVM switch to suit your budget and tastes. A two-way KVM switch with integrated cables tends to be pretty low cost. Total outlay will likely be around $200, for the switch and adapters, by my estimates.
I do recall seeing KVM switches built to pair a desktop with a USB-C laptop and so will have the single point USB-C attachment on one side but a more traditional USB-A, HDMI/DP/whatever, etc. for the desktop side. If you can find on of those that might suit you, but not likely to save money. There's at least one device that might be called a "dual host dock" that has all kinds of bells and whistles for someone that wants to plug in two laptops. Again this will be pricy, and may not be compatible with both of your computers.
My guess is you will have a fairly common USB-A keyboard, USB-A mouse, and a common display with HDMI and DP inputs. Perhaps the cheapest and easiest way to deal with this is just get a nice KVM that suits your keyboard, mouse, and display then get whatever adapters you need to plug it in. It sounds like you might have a pair of laptops like my own. I needed nothing to plug in one laptop and a cheap USB-C "microdock" for the other. It's a bit of a cable clutter but it works.