Rather than a switch, I use a multi-device keyboard and mouse:
Shop K380 Keyboard. Features minimalist slim beautiful design, Bluetooth connectivity, easy switch between computers, tablets & phones, long battery, & more
Shop M720 Mouse. Features full-size sculpted shape, tilt wheel with hyper fast scrolling, high precision tracking, dual connectivity, and multi OS compatibility
... even better for me given the keyboard layouts as I'm switching between Mac, Linux and Windows.
You pair the keyboard and mouse to each device and then it's just a case of pressing the relevant F-key to switch between devices. Your issue might be more that you also need to switch the monitor input as well, so in that case I'd say a dock would be a much better prosepect.
What a dock does is you plug in your laptop and then all your peripherals, so monitors, keyboard, mouse, etc. Unclick one laptop, click another in to enjoy your full rig. Your two laptops will both need to be able to talk to whatever dock you buy but pretty much any spare USB port will do to connect everything to the dock. Naturally, if you were wanting ultra-fast throughput to an external hard drive then USB-C is a must ... for monitor, keyboard and mouse, the wide USB-A will do just fine.
Finally, be aware that the output from the dock may be restricted in size. If you're using FHD (so, 1920 wide) then fine. You'll likely need to spend a lot more to get QHD or 4K. Some are restricted also to options like 2xFHD monitors or just ONE QHD for example. Again, a lot of that is down to throughput and so wider bandwidth USB-C is a must for larger screens.
KVMs switch two inputs to one set of keyboard, mouse and monitor ... so, you plug in both laptops and then keyboard, mouse and monitor(s) and use a switch to pass the active input between machines. Restrictions might be that you don't get more than one monitor attached. With KVMs, you have to understand the outputs from your devices as you'll need to send a USB and a HDMI/DP output from each laptop for each screen you want to run. You might not have, say, 2x HDMI on both laptops so look carefully at the KVMs.
By contrast, docks simply talk to your laptop via a USB cable and pretty much everything (so, keyboard, mouse and video) goes up and down that single cable. Hassle, if you like, is unplugging from one and plugging into the other.