The rear camera on my Xperia XA1 Ultra stopped working. At the same time, I found that the rear LED light (would not turn on in flashlight mode) stopped working as well. The front LED and camera still worked. I tried all the usual suggestions of clearing data and even performed a factory reset. When nothing worked, I assumed a hardware problem. I bought a new phone (Moto G6). The associate at the store took the SIM card and the SD card out of the Sony and put it in the Moto, leaving the Xperia with no SIM or SD cards. I powerd on the Sony once more and lo and behold the camera worked fine, as did the flashlight. So here's what I conclude: if the camera and LED on the Xperia don't work with the SD card in the phone but do work without the SD card in the phone, it must be an issue with the SD card, or the data on it. When I went though the content on the SD card after I moved it to my new Moto, I found several Sony files (which I deleted since they weren't needed in the Moto), it seems logical to me that there could be some corrupted data on those files that is used by the camera or LED functions.
So, if anyone is having similar issues with the camera function and LED not working, try removing your SD card and see what happens.