Ideally, you’d never need to replace an air conditioner in the middle of summer. An older air conditioner which needs to be put out to pasture should ideally be replaced in the fall or early spring, when there’s no demand for it and you can proceed carefully with your decisions.
Unfortunately, not every old air conditioner is polite enough to wait until September to break down, and if you’re facing a serious repair call in the middle of a heat wave, it may be more beneficial to simply replace the failing system instead of spending money unnecessarily to prop the older one up.