That could be a battery problem.
Have you installed iOS 11.3 or later?
If yes, what can you read going to Settings>Battery>Battery Health (beta) and tapping on it?
If you don't have iOS 11.3 or later, have your device/battery inspected / replaced at your most convenient Apple Store or Authorized Service Provider: Apple - Find Locations - Location Selector
Regards
Giulio