In 5 years they will still be fully supported and functional. Even at 10 years they will be very functional.
I have over 33 years of experience owning and using Macs. They are the best supported and most reliable computers in the long term. My 1987 Mac II was still running fine 10 years later. My 2010 MacBook Pro is still running fine. I expect my 2020 M1 MacBook Air to still be fine in 2030. I have two 2013 MacBook Airs in my home under heavy daily use (Wife and Daughter).
The only worrying part of a modern MacBook is the battery. Apple knows this and offers a reasonably priced battery replacement program. Generally for $129 to $199 you can get a brand new replacement battery installed in your out-of-warranty Mac. No need for AppleCare unless you want it (I have never had it on any of my dozens of Macs).
Need to repair your Mac? See your service options, their costs by coverage type, and how long they take.
support.apple.com
Of course some small percentage of Macs will have board failures along the way, and not survive to 10 years. Despite what Louis Rossmann (love his videos!) might say, this is a very small percentage.
Apple's switch to their own silicon for more and more parts will only increase reliability. The Intel Macs were becoming a big of a hacked together mess with parts from many vendors (like many Intel/AMD PCs). Expect modern Macs to start having life expectancy similar to iPads; with only battery replacement necessary every 4 to 6 years.
By the way; I think $129 is an incredible deal for parts/labor on a battery replacement. I have the tools and workshop to do the job at my home, but gladly would rather pay Apple $129 to do it. It is one place where Apple actually charges a lower than expected price for service
As an aside, I recently brought my 2015 12" MacBook in for a battery replacement. Battery life was below 70% as it had too many cycles (I believe over 1000). They not only replaced my battery, but also the entire lower frame of my Mac (new keyboard). They did this because they said the keyboards sometimes failed and they wanted to be proactive. Also they told me the computer was down at the time I picked up my MacBook so wouldn't charge me. My eyes just about popped out of my head.
A week before this I had brought in my aging iPad Air 2 for a $99 battery replacement. The returned unit was refurbished "like new" to my eyes. Pretty awesome deal.
Despite many complaints to the contrary, Apple quite often has the best customer service in the industry.