Since they no longer make a 27" iMac I am just going to get a 24" m1 iMac. Should I upgrade now or hope they support it for one more software update after this?
I think it's completely unpredictable whether the 2023 MacOS release will drop support for the 2017 iMac.
It depends how worried you are about having the latest and greatest
bugs features - otherwise, if Ventura
is the last version and the 2023 MacOS doesn't run, you'll probably have at least 2 years of security updates. After that, it's down to whether any "deal breaker" security issues appear (which isn't
that common - esp. if you're talking about a desktop that doesn't talk to any strange wifi networks - and it doesn't mean you won't be able to keep third-party anti-malware stuff, web browsers etc. up to date).
Problem is, Apple doesn't commit to
any fixed support period so everything is based on looking at their past behaviour.
They probably know how many of these old machines are out there and still running software updates & how much wailing and gnashing of teeth there will be if they drop a particular model.
I don't think that's a great situation - OTOH part of the difference between Mac and (say) Windows is that Apple can take a more "move fast and break things" attitude than Windows, which has to cater for the ultra-conservative (small 'c') corporate sector.