I currently have the late 2014 iMac. Due to it's poor design for cooling/venting, it's encountered an over heating issue. No longer under warranty & I don't know if I could handle taking it apart myself for cleaning, I'm looking at the Mac Mini for an upgrade. In the long run, going the Mac Mini route will be cheaper than an iMac.
iMac, at least the one I would get, if I got another, I'd likely go with the high-end iMac, which is priced at $3,000+.
Mac Mini, I'd go an i7 & maybe 512GB SSD, then upgrade RAM on my own. That's around $1,400. Granted after this, I'd also have to buy monitors (I prefer having 2), so day 1, I might be spending around the cost of an iMac, or more, if I get an eGPU. However, down the road when it comes time to upgrade again, I only have to replace the Mac Mini itself, given that all the other hardware is still doing well.
Whenever you go to upgrade from an iMac to another iMac, you're looking at another $3,000+.
Both machines have their intended audiences though. The iMac is a nice all-in-one machine. It can game & process videos (not done this myself, but seen videos on it). The Mac Mini can do all that as well, if you add an eGPU. Mac Mini also gets the display of your choice.