My phone keeps dying and it's pissing me off

I have a Google Pixel 7a, and I’ve only had it for a year. At first, the battery lasted a long time and charged efficiently. However, in the past few months, my phone has started rapidly depleting and dying, sometimes even powering off without reaching 0%. This morning, for example, I left the house with 87% and it died within 15 minutes. An hour ago, it died at 40%, but when I plugged it in, it still showed 40%. I haven’t downloaded any new apps or opened any sketchy links. Buying a new phone is out of the question, so I could really use some advice.