Hi Tommy,
By my count there are five possible sources of your problem inside the phone, since you've already eliminated possible external causes (charger and cord). Here's the list.
# Charging port
# Battery
# Auxiliary (daughter) card
# Interconnect cable
# Motherboard
If it was my phone, I would probably go ahead and order the first three parts and change them all out. If those don't do the job then the source of the problem could theoretically be the interconnect cable that runs from the daughter card to the motherboard and would be worth trying, but frankly I'm skeptical that would be the problem.
After that, you're left with it most likely being a motherboard or power controller issue which would require board level repairs that wouldn't be worth the cost on a phone that old.
iFixit has guides available for replacing the charging port and battery, but unfortunately doesn't cover the other three parts. However there is a Spanish site called Nadie Me Llama Gallina that has guides for those as well as the auxiliary board and motherboard. If you use them with a web browser like Chrome that has translation built in, the guides are quite usable. (Note that "battery" comes across the translation as "drums" for some reason.)
* [guide|124576|Google Pixel 3a XL USB-C Port Replacement - iFixit Repair Guide][br]
[link|https://www.nadiemellamagallina.com/en/manuales/smartphones-1/google-580/google-pixel-3a-xl-1133/conector-de-carga-10030|Manuales / Google Pixel 3a XL / Charging connector - Nadie Me Llama Gallina]
* [guide|124631|Google Pixel 3a XL Battery Replacement - iFixit Repair Guide][br]
[link|https://www.nadiemellamagallina.com/en/manuales/smartphones-1/google-580/google-pixel-3a-xl-1133/bater-a-10022|Manuales / Google Pixel 3a XL / Drums - Nadie Me Llama Gallina]
* [link|https://www.nadiemellamagallina.com/en/manuales/smartphones-1/google-580/google-pixel-3a-xl-1133/placa-auxiliar-10025|Manuales / Google Pixel 3a XL / Auxiliary board - Nadie Me Llama Gallina]
* [link|https://www.nadiemellamagallina.com/en/manuales/smartphones-1/google-580/google-pixel-3a-xl-1133/placa-base-10023|Manuales / Google Pixel 3a XL / Motherboard - Nadie Me Llama Gallina]
If you need to save money then once again I'd suggest replacing those parts in that order one at a time