If your iPhone's sensors aren't working correctly, you may need to calibrate them. Here's how to calibrate an iPhone's brightness and motion sensors.
You can turn on dark mode on an iPhone, iPad, or iPod Touch through your device's Settings app or Control Center.