As with any lithium battery, the amount of time the battery stays charging at 100% will reduce its efficiency. With iOS 13 and newer, your phone will learn your daily charging habits to help improve the lifespan of the battery.
When enabled, your iPhone will stop charging at 80%, then continue to charge to a full 100% shortly before waking up in the morning.
Here's a quick and easy way to see if Battery Optimization is on and how to turn it off.
In settings, tap "Battery"
Once in the battery setting, tap "Battery Health"
Battery Optimization is on as the default setting. You can turn it off by tapping the toggle switch.