Ok this really only applies to cars which let you use your cell phone as a key. But more broadly, it’s a good idea to have two ways to get into your car.
For Model S and X owners, the key fob needs to be alive and you should make sure to change the battery. The backup is the Tesla applications running on your phone. It connects via a Internet connection to the Tesla cloud. If you are deep in a parking garage or if the service goes down you will have a problem.
For Model 3 owners, carry your credit card sized key with you as a backup. In that case the main entry is via the Tesla application. This works standalone and doesn’t require Internet or the Tesla cloud to running, but of course, your phone can always run out of battery.
If you want to read about Model S/X owners who didn’t do this see https://jalopnik.com/drivers-stranded-after-teslas-app-goes-down-for-hours-1837847138