I'm wondering if the phone is reacting by itself because it believes the screen needs to be dimmed due to various lighting conditions.
Take a look in this similar thread which may help.
I'm using a different model to you as per my signature below and the screen dimming does not happen on mine.
Certainly a conundrum !
A Samsung Experience Store or Samsung Service Centre can take a look.
Current Phone >Samsung Z Fold³ 5G.
Previous Phone > Note 20 Ultra 5G SM-N9860.
@Maxvax: The screen will dim slightly prior to going idle, which may be a possible explanation. With this in mind, try heading to Settings > Display > Screen Timeout, and increase the time here to see if you notice an improvement. You could also try Settings > Advanced Features > Motions and Gestures > Keep Screen On While Viewing > On.