The other option might be a workaround product called Luna Display (by Astropad).
I'm not sure how practical it would be – even the iMac that you were trying to salvage had a 27" 5K Retina display. Your M2 MacBook Air has only two USB-C (Thunderbolt) ports. You need to plug the Luna Display "dongle" into one of them. They don't support plugging it into a hub or dock. Then it's a good idea to run a cable between the two Macs to help carry video data, which means you lose your other USB-C port unless you have a hub or a dock.
The Luna Display people themselves say that their product is not recommended for applications involving rapidly changing video content. I believe they gave video editing and gaming as examples.
Your MacBook Air M2 can only drive a single external monitor, but it can be a very high-resolution one. If you don't have the budget for a 27" Apple 5K Studio Display, you might want to consider a 27" 4K third-party monitor which has an IPS screen and near-100% coverage of sRGB. Some of those cost as little as $300 – $350, though one that has USB-C (DisplayPort, Power Delivery) and can act as a mini-dock for your MBP might cost a bit more.