Provided that each monitor will take 2 or more inputs, you can use the monitor’s controls to choose which input to display. Of course the number of button presses to make that happen on two screens would start to get annoying if you do it multiple times per day.
Another option would be to connect each Mac to one monitor and use universal control to allow one keyboard and mouse/trackpad control both macs. This allows you to use the macs in a complimentary way, but it doesn’t allow you to drag windows from one screen to the next. It’s a cool feature, but does require a slightly different mindset. If you happen to use and like the stage manager feature, you may like this.
AirPlay will allow you to use another mac’s screen as an extended desktop (typical dual monitor setup). The downside is that the resolution is limited to 1080p, and you’ll see some compression artifacts. It works great if the viewing distance is a little further than normal or on smaller screens.