If you’re doing development-related work as seems possible given where this question was posted, then go for 16 GB memory minimally, and for more internal storage than you think you need now. Xcode isn’t a small or lightweight app, and apps and macOS and all our files and data all tend to expand over the useful life of a Mac. Check the minimal and recommended hardware configuration recommendations for whatever apps you plan to use.
Check the number of ports you need. iMac can have either two or four ports, and can optionally have a wired network port, for instance. MacBook Air (M1 or M2, no M3 is available) has two Thunderbolt / USB 4 ports.
Desktops such as iMac, mini, and Studio are generally less expensive than the (equivalent or even lower-spec’d) portables, or are more capable as you’re paying extra for the portability. Or paying extra for expandability in the case of Mac Pro. Different targets and different usages and different trade-offs exist.
Had several folks buy MacBook Pro models because they thought they might use it away from their desks, maybe, eventually, and then never traveled with it. At all. That wasn’t the best trade-off. A Mac desktop would have been cheaper and/or had better features. A Mac desktop and an iPad might be cheaper than a higher-end portable too, if you do need some portability, or if an iPad can suffice, too. Trade-offs, trade-offs everywhere.
Base model M1, M2, and M3 support twi displays, one of which is always the internal display when equipped.
Of the MacBook Air and the iMac reliability, I’d assume the iMac a bit more reliable, but only because portables are out and about, and seemingly more likely to get dinged, or dropped, or stolen.
If you want to re-use some parts over a future upgrade, a Mac mini and a display, or maybe a Studio and a display, might be a better approach. A good or higher-end display might potentially be re-used for the next Mac.
Plan to buy an external hard disk drive (or a NAS, if you have the budget) for backups. Figure four to six TB capacity or so, minimally.