Everything has a lifespan
Even a virtual one can wear out pretty fast.
In my understanding, there are three moments you need to evaluate an electronic device in order to decide whether a replacement or retirement is appropriate.
The first death would be when the official warranty expired.
Given the complexity(and intentionally making them unrepairable by manufacturers) of most electronics today, it may be impossible to restore their health once you go over this point.
The second death would be when the device stops receiving software/firmware updates.
At this point, the device may still be functional. However it will gradually become less useful as the whole world moves on. Moreover, new vulnerabilities discovered will have no one can or cares about fixing them.
The last death would be when it finally gives up. The poor thing bears too much wear and tear that it can no longer take any more burdern. I hope you have prepared for the day before it comes.
Not surprisingly, I believe the second death and the last one could be decades apart.