For business use recommend replacing computers ever 4 years on average. For Laptops, a 3 year plan is more practical. Laptops tend to move around and take hits and drops, which take a toll on hard drives, and tend not to last as long.
Costs of maintaining hardware for longer than 4 years begin to outweigh benefits of not replacing the hardware. Things over 5 years old begin to become active problems for doing business. Several reasons, hard drives spin, and after so many years, the spinning slows down, and no matter what maintenance you do, the slower Hard Drive Disk Spinning translates to slow computer.
For individual users, as long as you turn off your computer at night or when not in use, I expect the computer to last 5 to 7 years. generally operating systems as they get older cannot run new software or Apps hence initiating a replacement. .
Hardware can last for longer than 5 years and run just fine. It may even still be useful. This, however, should not be an expectation. Manufacturers aren’t building to a tolerance that supports this expectations and chances of failure go up as the system ages.
Running systems into the ground and making a purchase at a time dictated by the failure of your computer is a recipe for a poor technology purchase on your next system, and increases the chances that you will lose something in moving from your old system to the new