Batteries age chemically as a phone gets older, so getting fewer hours out of the same charge is normal. The real questions are how fast that is happening and whether the battery genuinely needs replacing.
Both iPhone and Android have a screen that measures this, but the menu paths are completely different and vary from brand to brand. Recent releases have also added settings that stop charging at 80 percent.
Below you will find where to read battery health, how to interpret the number you see, and finally the manufacturers' own official advice for extending battery life.