Based in your description, it is possible that your iPhone is damaged or it’s battery has failed. Either way, only an authorized technician can make that determination. Take it to an Apple store or an authorized service provider for evaluation. If you have some form of AppleCare, then it is probably covered with a replacement fee. Otherwise, the standard warranty period is 12 months.
Still possible, but less likely, is that your charger or charging cable is damaged. You can swap in another to rule that out.
I have an old iPhone 6 with a failed (and swollen) battery. It behaves exactly as you described.