I haven't done this variation but what I will say is that barrier (formerly synergy, which is still around but no longer free and open) is a great app for using two machines and their monitors as if they're one. I've used it for a desktop plus laptop all the time. Even works on a steam deck.
For windows only folks, mouse without borders is a great option and it's built into windows power toys, otherwise synergy is a excellent cross platform solution that's worth the license cost.