Sounds like the proximity / light sensor.
This turns off the display to stop accidentally pressing the screen while in a call to stop activating any other functions etc, and preserves battery usage from the display.
Daily Driver > Samsung Galaxy s²³ Ultra 512Gb in Phantom Black.
The advice I offer is my own and does not represent Samsung’s position.
I'm here to help. " This is the way. "