Please make sure everything is updated in regards to your apps.
First please put the phone in Safe Mode which disables your downloaded app's but let's your stock app's keep working. If the issues stop then this highlights a downloaded app as the possible issue. Come out of Safe Mode and start deleting your most recent downloaded app's one at a time until it stops.
if not help then …
Clear your phone's System Cache Files by turning your phone Off and then from a set series of button presses go into the phone's System Files and clear the cache. No information is lost this way.
If that does not help then try a factory reset after backing up and removing any relevant sd card.
Current Phone > Samsung Z Fold³ 5G. > Software : Android 12 ~ Samsung One Ui 4.