Thank you for contacting Samsung KSA
one of the primary factors that can cause this issue is a failing battery when you try to use a camera or any other power intensive app the tendency is that the battery will need to provide more power to the phone
try to clear the cache from the device settings
Perform Interactive checks through the Samsung Members app (Samsung Members> Get Help> Interactive checks->camera).
check your device in the safe mode
if you still face the same issue then kindly visit the nearest service center
the link of the service centers:https://www.samsung.com/sa_en/offer/service-centers/