My Macs usually last a few years from a productive standpoint at least.
I have 8 machines from over the last 20 years sitting in my cupboard at work. I’ve been using them since the mid 90s. They’re great for the first few years, then with constant OS upgrades they slow down to the point where they’re unusable. I’m using cloud based software so upgrading is impossible to avoid if you need to run the latest apps - which I do.
On saying that, if you clear the hard drive and reinstall the original software they’re as good as new. My MacBook Pro - 2007 - is running OS 10.4.4 and some Boss simulation software. I don’t run anything else on it. And my Blue & White G3 PowerMac (1999) is still running OS 9 and one of the first versions of iTunes.
So I guess if you can find an older machine that will run your applications and you’re not planning on trying to stay up with the latest apps, they’re a great bit of kit.