Recently I noticed that my iPhone 5S switched off because of low battery even though it showed that is was about 50%. After doing several reboots and full charge/discharge cycles the issue was not resolved.
To estimate the battery state of charge, usually the power manager circuits measure the battery voltage. I noticed that the iPhone would switch off when under heavy use (first time was when I was using the GPS to drive to an unknown address, not funny). After several hours, it could switch on again without recharge.
As the problem got worse (it switched off at 70%) I saw that the display popped on the left hand side, just above the battery. Indeed, the battery was swollen and pushed the display, making it a curved designed iPhone (not yet implemented, or at least announced by Apple).
So, I ordered a new battery by iFixit, together with the necessary adhesive strips. As, there are numerous youtube videos of Li-Ion batteries exploding, I preferred to switch off the phone for ~10 days, waiting for delivery of the components. Very relaxing and care-free ten days.
With the arrival of the components (and the necessary complementary candy) I opened the phone and to remove the swollen battery. I have replaced batteries on the 3GS and 4 models. The 5S a lot tougher to disassemble. The flex cables are extremely fragile.
Just for curiosity I opened a small hole on the battery, making it swell even more.