One problem can be one repair
If one joint or section has failed, it is easy to reach, the pipes around it look sound, and it has not happened before, a single repair often makes sense.
The new part still has to work with the pipe it connects to, and the repair should take into account whatever shows up once the pipe is opened.
Repeat problems add up
Several leaks, widespread corrosion, walls opened again and again, pipes you cannot reach, or a renovation already planned can make replacing a larger section the better deal.
Age or pipe type alone is not enough reason. Look at what has actually failed and where.
Compare quotes fairly
When comparing options, check which pipes are included, how walls and ceilings will be opened, what stays, how long the water will be off, and what patching or finishing is not included.