That was the same experience I had. MagSafe worked fine yet USB-C didn't. I tried multiple chargers and cables with no joy. Then the problem went away and to my knowledge, I didn't do anything to fix it beyond multiple restarts.
Using early 12.x the USB-C charging worked fine but stopped working with 12.2 or 12.3. I don't remember which. Then I haven't seen the problem resurface.
Also, my "new" MBP went tango uniform and Apple had to basically replace all the electronics inside after 9 months of use. Before Monterey, I was experiencing a panic every morning when I first opened the lid. What I had found was that charging with the USB-C and closing the lid "sleep" caused a panic after a few minutes of charging. I have no idea if my later motherboard failure was tied to earlier panics using USB-C charging but it was interesting to note.