Why Your iPhone Screen Keeps Dimming (and How to Stop It)
Auto-Brightness is the usual cause: turn it off in Settings > Accessibility > Display & Text Size. If the screen still dims, check Attention Aware Features, Low Power Mode, Auto-Lock and heat. When it dims tells you which one.