Some good quality car batteries can last 10 years and even 15 years which has happened to me.
There's no guarantee that a car battery will last you longer than 10 years or even 5 years but the battery that I had last me 15 years was an interstate battery that I had in a truck.
I bought it 15 years ago at the time it died.
I was never expecting the interstate battery to last 15 years and I was maybe expecting 8 to 10 years at most but surprisingly the battery lasted me 15 years so I got my money's worth from it.
However if your battery today is a cheaper battery and it's 5 years old or older then I would be saving some money to get a new one before it leaves you stranded.
Most batteries today last at most 5 to 7 years depending on the battery brand.
The cheaper brand of batteries usually don't last as long.