Apple has released a beta version of iOS 13.4. This is meant for developers to test, but the general idea is, it'll eventually roll out to consumers' iPhones with new features, including one that will allow the iPhone to work as a car key.
9to5Mac discovered the beta mentions a “CarKey” API that will enable the iPhone and Apple Watch to unlock, lock, or start NFC-compatible cars.
The Apple device only needs to be near a vehicle to work as a key, and because the feature doesn't use authentication like Face ID, it'll work even when a device is out of battery. Reportedly, you'll be able to adjust settings for this feature in the Apple Wallet app, where pairing is done.
The Wallet app works with a manufacturer’s app during setup - a process that involves users putting the iPhone on top of an NFC reader in a car, at which point Apple's CarKey option will appear in the Wallet app. CarKey can then be shared with others, including family. You need to invite them through the Wallet app, and then they'll be granted access to the key through their Apple devices.
Apple is apparently partnering with some manufacturers to integrate CarKey, though the feature likely won't arrive until iOS 13.4 officially releases.