Another feature first promised in WWDC comes to iOS 15.2. The Legacy Contact feature will let you pick a contact that will be able to access and download your Apple ID data in the event of your death.
This works with a special code provided by Apple, along with a death certificate. Once available, Apple will be able to unlock your iPhone or iPad.
Once both devices are running iOS 15.2, go to Settings > Profile > Password & Security > Legacy Contact to get started.