I agreee with
@USAFRet, longevity matters heavily on the usage.
You can do basic browsing on a 15+ year old pentium, but it will struggle with almost any sort of heavier load, like gaming.
For your gaming/ basic usage?
Depends on the games, but you could squezze 4-5 years from a i5 10400 without any problems.
6 cores and 12 threads will have no problems running cpu demanding games for a long time.
Up that to a 8 core 16 thread i7 10700, and you would probably get 7-8 years out of it, similarly to how people still use almost decade old i7's today ( i7 2600K/3770K were realeased almost 10 years ago).
Out of a i9?
It will game similarly to the i7 i mentioned above, but it being a 10 core 20 thread cpu, you are probably looking at 10 years of usage.
Dont take what i said way to seriously, nobody knows what future games will demand, im just speaking from experience.