Your iPhone lies about how full the battery really is
Lithium ion batteries are all kinds of quirky, and it’s actually bad for them to be at 100% or fully depleted to 0% because it messes with their longevity. So iPhones, and other smartphones that use Li-ion batteries, purposely throttle how much power they demand from the battery.
When it's plugged in, your iPhone will cease charging before the battery actually reaches a full 100%. It will also preemptively shut down before it’s completely out of juice. The latter not only protects the battery, but also ensures there’s enough power in there to complete a safe shutdown, and to issue the dreaded “needs charging” screen when you try to reboot.