IME, macOS (Monterey on M1 Pro) handles this better than Windows 10. Everything goes to the right places right away, whereas in Windows you'd have windows all over the place.
That is, if you have for example a 27" 4K monitor next to a 27" 1080p monitor then the 1080p version is treated as though it's 25% of the size and the mouse gets "stuck" in the 4K monitor unless you're within the 50% of the screen that Windows thinks your 1080p monitor is adjacent to. This works sanely in macOS as it rightly treats each monitor as having the same size.
It's even more comical if you have a very high dpi laptop next to a 1080p or 1440p large desktop monitor.
It is really forgetful and switches the order of them when it wakes seemingly at random.
macOS's display handling has been flawless to me.