Have you got an iPhone?
Check your battery status by going into your settings and hit the Battery section, then open battery health. (if you can’t find it, then you may need a software update). If your battery health is below 90%, it is highly recommended that you get a new battery. An older battery can cause your phone to run much slower along with dying quicker. Commonly it can turn off at 30% or less and then just come back on.
This is how Apple (allegedly) tricks you into thinking you need a new phone. Which you don’t. You just need a new battery to make.it perform better. There is nothing wrong with your phone. Just a poorly battery.