Sure, but a swollen battery in most cases can simply be replaced. Replacing the whole phone out of warranty would at least be a lot more expensive, so I'd hope Apple doesn't force this option on the customer if it isn't actually necessary.
As someone who has had their iPhone 5 replaced three times because of a swollen battery I can tell you that they will replace the entire phone.
Why?
Because unlike a dead or dying battery, swollen batteries require special tools and a special process done by people with special training. If, during the replacement the battery is punctured it can be …explosive.
No Apple store does or is allowed to do this. All iDevices with swollen batteries are sent to a special facility for that.
Consequently, Apple is willing to give the customer a remanufactured device while claiming the parts of the one with the swollen battery.
Final note…the batteries are encased in a protective sleeve so there is no need to worry about problems while it's swelling. The danger is if that sleeve gets punctured.
EDIT: If this is a common issue (like with the iPhone 5) Apple only charges for the battery replacement and not a device replacement cost.
[doublepost=1565216647][/doublepost]
Discharge, then don't use or charge a phone that has a swollen battery. It could catch fire or explode.
Only if punctured.
There is no danger as long as the sleeve that encases the battery isn't punctured or damaged.
Not that I'd continue using one with a swollen battery though…