A M2 MacBook Air will drive a single monitor, and as long as you stick to common resolutions such as 1920x1080, 1920x1200, 2560x1440, and 3840x2160, there's no problem. The M2 MacBook Air will even drive a 5K monitor or 6K monitor over Thunderbolt. Note that with an ultra-wide monitor (e.g., 3840x1080 or 5120x1440 pixels), there might be some risk of not being able to select the proper resolution for the "oddball" monitor, even though the M2 hardware will happily drive other monitors with more demanding (but more common) resolutions.
A 2010 iMac can drive a display with a resolution of up to 2560x1600 pixels. If you get a 4K monitor, that monitor might not work with the 2010 iMac. (The only way it could, would be if the monitor told the computer that it could accept a lower-resolution signal like 2560x1440 or 1920x1080, and the computer took it up on the offer.)
I don't think the 2010 iMac will work with an ultra-wide monitor.