I will normally agree with our colleagues @dialabrain and @den.thed that use of your old iMac as a monitor is not possible. But I've learned recently that beyond the typical target display mode feature - currently quite dead - a couple old iMacs included native support for video input via DisplayPort sources. You're in luck because your 27" mid-2010 iMac is one of these.
iMac (27-inch, Mid 2010) - Technical Specifications - Apple Support
❝ Graphics and video support
- [...]
- Mini DisplayPort output with support for DVI, VGA, and dual-link DVI (adapters sold separately); 27-inch models also support input from external DisplayPort sources (adapters sold separately)
As for your MacBook Pro, the specs indicate support for DisplayPort output via USB-C.
MacBook Pro (16-inch, Nov 2023) - Tech Specs - Apple Support
❝ Display Support
[...]
M3 Max
Simultaneously supports full native resolution on the built-in display at 1 billion colors and:
- Up to four external displays: Up to three external displays with 6K resolution at 60Hz over Thunderbolt and one external display with up to 4K resolution at 144Hz over HDMI
- Up to three external displays: Up to two external displays with 6K resolution at 60Hz over Thunderbolt and one external display with up to 8K resolution at 60Hz or one external display with 4K resolution at 240Hz over HDMI
Thunderbolt 4 digital video output
- Support for native DisplayPort output over USB‑C ❞
For your case, I recommend that you use a high quality USB-C to DisplayPort cable from a Thunderbolt port of the MBP to the DP input of the iMac to get the job done. Maybe even a certified Thunderbolt 3 to DisplayPort cable, though that might be overkill. If you search Amazon or google you'll find the proper cable.