The proximity sensor is not working properly.
Ensure that a screen protector or case is not interferring with the sensor by removing them.
If the issue still occurs, basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new). Try each of these in order until the issue is resolved.
If none of the above resolves, take the device to Apple for evaluation and possible replacement.