Other than QB, OL and DL, I usually don't resign guys that close to retirement. If I draft a skill guy or LB/DB, I'll give them a 6 year extension after rookie contract expires, then that's it. Sometimes I'll sign a FA in their 5th year and the contract takes them into year 10, and that's OK.
If it's a player already on your team in the last year of a contract, let them hit the free agent market next season, then try to resign them. Sometimes you may lose out on the guy, but you also don't have to get stuck with a massive dead cap hit. If you do resign your guy, it will often be for less years and less bonus than if you renegotiated the season prior.