you need something like a kvm switch device..monitor, keyboard and mouse connect to device, then both pc's connect connect to device also...then just flick switch to move from one pc to other. You can program to do on keyboard..Think used to have shift+alt+1 for pc 1, shift+alt+2 for pc 2, but you can program any combo, but that depending on the switch and cost
just google below..cost £29.99 for kvm setup which can take 2 pc...£30...button on top with led ring green/blu depending which pc you're on
KVM Switch HDMI 2 Port Box,ABLEWE USB and HDMI Switch for 2 Computers Share Keyboard Mouse and one HD Monitor,Support UHD 4K@30Hz,with 2 USB Cable and 2 HDMI Cabl
above is just a cheap example I haven't tried, and no hot keys so can't say whether it's good or not. Can't remember the one I had at work, but was pricey amd linked 3 pc to 6 screens
if you're going to be sharing data, maybe worth maybe investing in a nas device...