When you have connections such as
Wi-Fi on while the phone is in sleep mode, some apps may still continue to use the battery.
Battery optimization is enabled for most apps by default which helps prolong battery standby time when you're not using the phone.
The phone needs to be sitting idle for an extended period of time before battery optimization takes effect.