Mobile phones are electronic devices and the condition of electronic devices will always deteriorate with time. When you cough up money to purchase a new phone, you always know in the back of your mind that you will one day need to replace it, but you get it all the same. Now you can't help but wonder 'How long is OK to use a phone?'
Toward the end of your phone's life, it will most likely begin to slow down, applications will start to crash, the software updates will no longer be available, and sometimes you might not be able to download certain applications. Now, when you begin to see all these signs, then you know it's time for an upgrade.
But do we really have to use our phones until they get to this point? Why do football coaches sometimes substitute their best players even before the match is over? Of course, they do this because that player has already served their purpose. Or perhaps they do it to save them for a future game. In the case of your phone, changing it before it's completely unsalvageable would be prudent because like the footballer, it has served its purpose. And also because, this way you can get something for it if you decide to sell it off, or at least put a smile on someone's face if you would rather gift it to someone in need.
In a study published by Statista, the average life span of a smartphone is two years. Anything beyond that might mar your enjoyment of it because of the lags and cracks and software issues. This is regardless of the fact that a large number of people will often go for fairly used phones, and fairly used phones will of course come with a fairly reduced lifespan.