The sphere should change size
Otiluke's Resilient Sphere says:
The sphere is weightless and just large enough to contain the creature or object inside.
Though not explicit, nothing in this description implies that the size is static and that the sphere won't adjust to a creature of changing size. It states that the effect is large enough to contain the creature. The effect of this spell is ongoing. If the creature changes, the size of the sphere must also for this statement to remain true.
Thus, if the creature's size changes (as long as it remains Large or smaller), the sphere would adapt to the new size. No damage would thus be taken.