iPhone XR

Depending upon the age of the phone, take it to an Apple store & explain the problem. I had multiple problems with my iPhone 12, it black screened the day I had an appointment with Apple. It turned out there was a problem internally, it seems to have been corrected by whatever the Apple techs did.