Universal Control lets you move from iMac to MacBook when they are side-by-side.
Universal Control is turned On in MacOS Tahoe and this is a mind-bending experience. Drag from Sequoia (left) to Tahoe (right) and double-click (same mouse) to open there.