Use the above info to look up the battery health; the maximum capacity. If it’s at 80% or lower, or if you’re getting unexpected shutdowns as you’re reporting, then your battery is failing, or your iPhone hardware is failing.
You’ll then be considering either a battery replacement, or a replacement (newer, used, refurb, new) iPhone.
iPhone Battery Repair & Replacement - Apple Support
iPhone 7 tops out at iOS 15. You’ll be able to get a couple of more years of app usage out of that iPhone 7 (assuming the battery is failing and gets replaced), before apps will start to require later versions of iOS past iOS 15. I probably wouldn’t spend on a repair for an iPhone 7, past battery replacement, though.