When should an iPhone or MacBook Battery be replaced?
The simple answer to your question is to replace the battery when you feel your device needs to have the battery replaced. In other words, if your device no longer functions as long as you need on battery power, then it's time for you to consider replacing the battery (or the device).

You don't specify the exact models of your devices, but any MacBook produced in recent years has a battery rated at capable of 1,000 charge cycles. Also, clicking on the Battery icon in the menu bar will indicate its health and, if necessary, whether you need to service or replace it.

In terms of iPhone batteries, they're rated at capable of a maximum of 500 charge cycles. Apple has also confirmed that a future iOS software update will provide users with info about the health of their battery, allowing them to determine if the condition of their battery is affecting their iPhone's performance.