Have you checked the battery health/cycles? Mine was like that, even iOS at once unexpectedly shutdown...
The battery page in settings, under Battery Health should tell your capacity and other info. for me a new battery fixed everything... and batteries aren't usually covered under warranty as far as I know in general but Apple replaced it for me. FedEx Overnighted it to their repair center in California, and then back. So only without a phone for a few days. Kinda like a brand new phone just by changing the battery.