The 2020 iMac does not support Target Display Mode. Apple dropped that feature in Late 2014, when the first 27" 5K Retina iMac came out. It never returned.
(See the bad news for yourself at: Use your iMac as a display with target display mode - Apple Support)
If both Macs are running Monterey or later, you could set up the 2020 iMac to be an AirPlay Receiver. This wouldn't require a Thunderbolt cable. It won't let you take advantage of the iMac's 5K resolution, and you may see the sorts of issues sometimes associated with "software" display connections (such as lag).
System requirements for Continuity features on Apple devices - Apple Support
Set up your Mac to be an AirPlay Receiver - Apple Support
But given that it's built in to macOS, it would cost nothing to play around with it (as opposed to the cost to try a third party workaround product like Luna Display (Astropad) or Duet Display).