Hi, thank you for reaching out to Apple Support Community.
From past experience in handling and repairing devices, especially iPhones, this sounds like it could be a potential battery issue, or a hardware issue elsewhere in your iPhone.
I would recommend contacting Apple Support through https://getsupport.apple.com or the Apple Support app. You may want to have your iPhone checked by a repair technician, either at an Apple store or an authorized Apple service provider. You can find some of these at Explore Service Locations.
Sorry to hear you are having this issue, I hope you are able to get it resolved. Otherwise, thanks for reaching out, and please have a great day and a great 2024!