Hello Davenelyu,
Thank you for using Apple Support Communities. We'd like to help recommend some settings you can check to see if you can stop your device from auto-dimming and locking itself. Follow the steps below:
1.) Go to Face ID & Password and security.
2.) Once in your menu, scroll down to Attention Aware Features. This feature will not dim your display if you're looking at your screen.
3.) Go to Settings > Display & Brightness.
4.) Edit and change your Auto-Lock feature to your preferred one.
5.) Also, go to Settings > Accessibility > Display & Text Size and check one your Auto-Brightness.
We hope these steps help you. Thank you for using Apple Support Communities. Take care.