You can't. The Target Display Mode feature of the 2011 iMacs, that allowed their use as Thunderbolt displays, was limited after the fact by the "2019 or earlier" and "macOS Catalina or earlier" restriction on the source Mac.
If this restriction didn't exist, you'd need a Thunderbolt 3-to-2 adapter ($50) and a Thunderbolt 1/2 cable ($30) to reuse a 21.5" Mid 2011 or Late 2011 iMac, with a resolution of 1920x1080 pixels, as a less convenient (have to boot up and press Command-F2) equivalent of a 24" 1920x1080 pixel monitor. Spending $80 on cabling and adapters when new monitors (with a long life ahead of them) have gotten so cheap might not be financially attractive.
The 27" Late 2009 and Mid 2010 iMacs are the ones for which the new restrictions on the source Mac hurt, since if they really acted as Mini DisplayPort displays in TDM, you'd expect to be able to hook them up to one of today's Macs with just a cheap (and reusable) USB-C to Mini DisplayPort adapter cable.
Even there, you can get new 27" 2.5K monitors for as little as $300 – $400 (rough guess), down from the $1200 that Dell wanted for such a monitor back when its monitor and the 27" Late 2009 iMac were new to the market.