Do I need to replace both tires at the same time, or can I just replace the rear or front tire?

Edited

It's not necessary to replace both tires at the same time. In fact, it's very common for the rear tire to wear out faster than the front, especially on children's bikes.

If your front tire still has good tread and no visible damage or dry rot, it’s perfectly fine to replace just the rear tire.