What steps did they take you through @tommy98 ?
The phone has built in diagnostic tools via the Samsung Members app and via dialing *#0*# in your phone app.
Also try clearing the cameras cache via Settings and Apps then Camera.
Finally if needed visit a Samsung Experience Store or Samsung Service Centre or arrange a doorstep repair if supported where you live.
Current Phone >Samsung Z Fold³ 5G.
Previous Phone > Note 20 Ultra 5G SM-N9860.