The Distinctive Baritone put it quite well, I would just add that to further complicate matters today, many composers are writing in such extremes of vocal ranges that they how little consideration for how human voices really work. Evan Hansen, for example, spans from an A2 to a Bb4 in just the song "Waving Through a Window"--and both notes are sustained and repeated. In opera, a role a with an A2 would pretty unambiguously make the role a baritone/bass role, but few baritone roles and certainly no bass roles would require a Bb4, especially one sung again and again at the climax of the song. In my opinion, many contemporary composers inadequate at conveying emotional stakes through melody and harmony compensate by pushing their performers' ranges. That's not to say that if a performer has an impressive vocal range the composer shouldn't take advantage of it, but many leading roles in contemporary musicals just expect too much of actors and inevitable take their tolls on the vocal folds.
But, yes, as others have said, changing keys is a real thing that happens in musical theatre. And 99% of the time, the audience doesn't notice. But usually, it's only a step or two (as was the case for a couple of Diana's songs in Next to Normal when Marin Mazzie took over the role) unless the role is being reconceived for someone of a different gender (like when Patina Miller played the Leading Player in Pippin)