Most suppliers of HDD (and other electronics) provides warranty for their product, for HDD typically 3 or 5 years. Of course the warranty does not cover your data, it will only replace the drive when failed. So the warranty term is an indication on how long time the supplier expects the majority of the delivered units to last in normal use. For some units you can get information on how the supplier has expected the device to be operated to fulfill their life cycle expectation, it can be that they don't expect the device to be power cycled often. This applies to server and NAS drives, so don't put them in a desktop that's being powered off when not used.
Over time a HDD will be worn, this applies to the actuator, drive engine and capacitors. Failure in those elements will lead to a failed drive which is most unlikely to be repaired.
Some years a go it was a saying that a HDD supplier did not expect to replace more than 1-2% of all the drives produced - they would go bankrupt if the rate increased a lot. But HDD buyers tend prioritize a long warranty, so producers need to balance warranty term with replacement rate. So my these is that when you run a device beyond the warranty term you face 2 issues. First you will pay for replacement yourself, but a more than 5 year old HDD might be to small for your current needs anyhow. Second - and worse - failure rate is known to increase over time, and definitely after end of the warranty term.
So at some point in time you should consider replacing old drives, but when? Definitely hard to define the optimum time for replacement.
My current desktop actually runs a 8-9 year old 1 Tb drive, it runs fine (touch wood). Data on is not the most frequently used, but its nice to spread IO over more drives, and it is included in the backup schedule - going to a never drive in the NAS and from there to the cloud.
On my NAS I recently replaced an only 7 years old 2 TB drive, but it started to report errors - mostly bad blocks - so it was replaced with a never, faster and bigger drive. I recommend that you keep an eye on your logs. Because it's fun to install upgrades, restores are boring, data loss is horrible.
When reading the Backblace statistics you can see that some drives have very low error rates even after more than 6 years operation. So maybe we shouldn't worry to much over old HDD's, but of course new ones provide more space, less noise, less heat, less power consumption, and faster access so you can easily find a reason to replace