There are third-party workaround products that might let you make a "software"-type connection to an iMac:
- Luna Display (Astropad)
- Duet Display
I believe the second is "subscription" (rental) software.
There might be drawbacks compared to a real hardware connection to a standalone monitor. For instance, if you used the USB-C version of Luna Display, and a Thunderbolt cable, to connect to a 5K Retina iMac, you would use both of your M1 MacBook Air's USB-C / Thunderbolt ports, leaving no room to plug in any other accessories – or even the cable from your A/C power adapter. Even with the Thunderbolt connection the maximum refresh rate at 5K resolution might be limited to 30 or 45 Hz.
My feeling is that a good 4K display is the way to go. (Assuming that you don't have a huge budget that would let you purchase a 27" 5K display from Apple, LG, or Samsung.)