I had a recent success with this. I’m connecting from an older mac running Catalina (10.15.7) to a laptop running Ubuntu (25.04). Both are running NoMachine 9.1.24.
I couldn’t switch displays when there were 2 large monitors and the laptop screen. When I disabled the laptop screen and restarted NoMachine, switching displays worked properly.
Maybe it needs all monitors to be the same size??
Also, the ubuntu laptop was running Plasma Wayland window manager by default. It worked for me only when I changed this to X11 at the login screen. I chose Plasma X11.