Aveerji If the same device has random camera problems and random System Server crashes (https://discuss.grapheneos.org/d/20177-system-server-crashes-randomly-on-pixel-5), they might be symptoms of a common cause, potentially a hardware issue, especially since it's an older device, or perhaps some rare software configuration issue.
Though it would be quite disruptive, it might be illuminating to back up data and then factory reset. If the problems persist that would suggest a hardware problem.
With respect to just the camera issue, clearing the Camera app's cache and storage might help.
Another avenue would be collecting some crash logs.
Probably backing up all data would be a good idea regardless.