When you are not using your phone, the phone will automatically turn off the screen to save power and protect the privacy of your phone. You can customize the screen time according to your usage habits.
Setting path:
realme UI 5.0 & 4.0 & 3.0 & 2.0 & 1.0: Settings > Display & brightness > Auto screen off
realme UI R & Go Edition: Settings > Display > Screen timeout
ColorOS 6.0: Settings > Display & brightness > Auto screen off
Note: Auto screen off does not support setting to never-off screen.