Chosen Solution

I replaced the battery on my IPhone 8 last week, and every time I go to charge it, it restarts and reboots. And idea how to stop this?

Do a thorough visual inspection, preferably with magnification, of the area surrounding the battery connector. There are several tiny SMD components just above the connector. Of particular importance are the ones highlighted in blue below. If any are missing (which can happen when you pry the connector off), then the battery state does not get communicated to the CPU and this can also cause charging issues and fluctuating readings.

Put it back the old battery then observe if your phone still restart. i think your new battery has a problem.