It could be a proximity sensor issue.
If you have a cover case and/or a screen protector, check if they interfere with the proximity sensor, that is above the earpiece.
Shouldn't be this case, have your device inspected at your most convenient Apple Store or Authorized Service Provider:
Apple - Find Locations - Location Selector
Regards
Giulio