In the past I have used screen sharing over Ethernet on a M1 Mac mini to 2011 iMac but works well via thunderbolt too. A hdmi dummy is needed for gpu acceleration, these cost around £5-10 on Amazon and has a frame rate of around 30fps. Your set up may be better with them both being apple silicon.
The good thing about it is you use both iMac's. You can view the shared computer in a window or full screen, share files with drag and drop share a clipboard and share a mouse and keyboard.