My rear camera was unable to focus on objects more than 6" away. Could hear the motor clicking but lens was not moving.
Easy swap out. New camera solved the problem.
Read several threads on this issue. Some people were able to fix by bumping the iPhone and freeing up the lens motor/gears. But, when all else fails just replace the camera.