maybe a usb hub switcher like this one would be good?
You can use these:
https://www.amazon.com/gp/product/B01N6GD9JO
This allows me to switch off between the peripherals on my Macbook and my PC with a click of a button. Unless I'm misunderstanding the question.
I run my work laptop and gaming PC using the same monitor and peripherals. I simply switch the monitor input for the appropriate machine. For peripherals, I have this USB 3.0 switch to connect both machines. FWIW, peripherals are dongles connected to wireless keyboard and mouse and a USB DAC AMP.
UGREEN USB 3.0 Switch Selector 4 Port 2 Computers Peripheral Switcher Adapter Hub for PC Printer Scanner Mouse Keyboard with One Button Switch and 2 Pack USB Male Cable https://www.amazon.com/dp/B01N6GD9JO/ref=cm_sw_r_cp_api_glt_fabc_TX5Q3SAHSJ97WNAE7FTR?_encoding=UTF8&psc=1
I have this USB switch I use for exactly this case:
https://www.amazon.com/gp/product/B07FDNTS34/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
I picked up this one because I wanted the wires to be hidden away under my desk and to be able to place the button to switch between devices near the front of my desk where I can reach it easily.
If you don't care about those things, here is a cheaper option that I've also used:
https://www.amazon.com/gp/product/B01N6GD9JO/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1
If using the first one on only 2 devices, you may find it helpful to connect 2 ports on it to each device, like this:
This way when you push the button to switch devices it'll always be 1 button press to get to the other device. Otherwise you'd have to press the button a few extra times to cycle through the unused ports. (and if it's hidden away, you can't see the lights to see which port is active)
I use this usb switch from Amazon with a Raise, between a mac and pc, haven't had any issues https://www.amazon.com/gp/product/B01N6GD9JO/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
I use this. Press a button and swaps 4 devices between two PCs. It’s a single device solution. Connect 2 usb cables, one to personal pc and the other to my work laptop, and both to the hub. So happy with it https://www.amazon.com/dp/B01N6GD9JO?ref=ppx_pop_mob_ap_share
This is the one I have, but I only paid $30 via Newegg... https://www.rosewill.com/rosewill-rcus-17003-2-x-usb-type-b-female-to-4-x-usb-type-a-female-and-1-x-usb-micro-b-female/p/9SIA072GJ93091
Maybe it's not being made anymore :(
I believe this Ugreen also worked when I tried it at home with my Model M before taking it to my office to use with another keyboard/setup... https://www.amazon.com/UGREEN-Selector-Computers-Peripheral-Switcher/dp/B01N6GD9JO/ref=sr_1_3?keywords=ugreen+3.0+switch&qid=1678200648&redirectFromSmile=1&sr=8-3
Maybe you could purchased one of the Warehouse Deals to try it and just return it if it doesn't work? Amazon is super easy to do returns with when you buy one of the "open box" ones, since you're not opening a new one to try it out.
EDIT: Since all the suggestions were pretty bad, here's the easiest approach to this:
Regarding USB Inputs Among Multiple Computers:
Just get this for the 'USB' side of things for the 'K' portion of the 'KVM':
You can literally connect 5 USB devices to two SEPARATE computers.
That takes care of the USB side of things.
Regarding Video Output Among Multiple Computers:
This product then takes care of splitting an existing computer that has at LEAST 2 monitor outputs (ex: video card with two outputs, laptop like a Mac but with two USB --> HDMI adapters, etc) and allows you to display them onto multiple monitors.
I currently use this just to use 2 video sources (aka 2 HDMI cables coming from the desktop or laptop) and project them to 2 monitors. Apparently though you could totally output them to 4 monitors if you had a computer with two video cards, etc, that could do it.
Anyway, the routing possibilities are really good, so you can pretty much have a work machine on with 2 monitors, and use 2 other monitors for a separate machine using the same device, and swap the configs with manual buttons on the fly:
Probably the UGREEN USB 3.0 Switch should work.
I have one, but it is USB 2.0, and I currently have connected to it: one wired keyboard, one wired mouse and one Webcam from Logitech.
Everything works fine.
I use it to connect to a Dell PC and a Mac Mini M1.
Remark: This peripheral is not a KVM, you can not share the display.
Regards
https://www.amazon.com/UGREEN-Selector-Computers-Peripheral-Switcher/dp/B01N6GD9JO