XPRA or waypipe could help if you're running Linux on the workstations the apps actually run on.
wfh
comm for Work From Home enthusiasts, because it's 2023
you can only post slop from the wall street journal derogatorily
Pretty sure OP is dealing with laptops, not workstations.
What you want is a KVM or if both devices are laptops, share a docking station between the two.
I have my work laptop & personal PC on a KVM so I can just press a button to to from work to personal.
I've had my dual monitor supporting KVM from TESsmart since the start of Covid and will never not have a KVM again so I can just one the one desk setup.
So, do the monitors have multiple inputs? If so, two usb C docks and four display cables should do it.
Set each dock up for each of you, then connect both docks to both monitors with the four display cables.
Then you use the input switch button on either monitor to switch which dock it is displaying from to swap between two people one monitor and one person two monitors.
Edit: Just realized the fourth cable is unnecessary, and then one of the docks can be a cheaper one with only one display output, since you'll never use both docks with both monitirs at the same time.
This effectively turns the input switch button on one of the monitors into what switches the setup between the two modes.
It sounds like what you want could be achieved with no extra hardware (other than a couple cheap USB-C to USB-A adaptors) if the following things are true:
You have 2 monitors with multiple USB-C ports.
Your laptops have multiple USB-C ports.
Plug one keyboard and mouse into one monitor, plug the other into the other monitor. If you're both at the desk, you each plug in one monitor. If only one of you is at the desk plug in both monitors.
If your monitors/computers don't fit those requirements you're gonna end up buying more stuff.