This issue is observed in many of the users ,some have reported they are facing the issue when using the camera when the device is locked or using camera from other Applications.
Update iOS: Ensure your device is running the latest version of iOS, as updates often include bug fixes that may resolve such issues. The Mac Observer
Restart the Device: Perform a force restart to clear temporary glitches. Press and quickly release the volume up button, press and quickly release the volume down button, then press and hold the side button until the Apple logo appears. Apple Support Communities
Reset All Settings: If the problem persists, resetting all settings can help. Navigate to Settings > General > Transfer or Reset iPhone > Reset > Reset All Settings. This won't delete your data but will reset system settings like Wi-Fi passwords and wallpapers. Apple Support Communities
Contact Apple Support: If none of the above solutions work, reaching out to Apple Support or visiting an Apple Store is advisable for further assistance. The Mac Observer