I bought a new phone not too long ago -- but a cheap one, not top-of-the-line :)
Technology changes, and demands for more power/bandwidth, etc. continues to increase. Its hard to keep up.
Its possible that something broke, and your phone needs repair. A bad solder connection could cause intermittent issues.
But also... check for other still running apps in the background. Most apps continue to run (use CPU cycle and eat battery life), even after you've "shut them down"
Even after I've cleared my background running apps, I'll check again sometime later, and there are still more that didn't show the last time I checked. Annoying.
Even though you are plugged in, your phone is still running on battery. And in-between app cycles, the plug will recharge your battery on-the-fly.
It may be, that you need a new battery. Those don't last as long as they used to.
On my old phone, I only needed to charge it once a week. But eventually it got to where it needed a daily recharge. So I bought a new battery, but it too wouldn't last more than a day -- so I gave up.