The difference can be musical or lyrical, or both. Usually the reason for this is simply, “We combined two different songs” but the reason isn’t really germane here.
Classic example of “musical” would be “Layla”:
A good example of “lyrical” or possibly “both” would be Guns ‘N’ Roses’ “Rocket Queen,” in which the first 2/3 of the song is a funky metal number in which the lyrics describe a very sexually experienced and promiscuous woman, whereas the last third of the song becomes a tender power ballad whose lyrics end with “Don’t ever leave me/Say you’ll always be there/All I ever wanted was for you/To know that I cared”:
Genesis’s “Abacab” was overtly created from three song fragments that the band had written, which they referred to as “Section A,” “Section B,” and “Section C.” The name of the song comes from one order in which they had combined the three sections during recording (ABACAB), though the final version of the song isn’t in that order.
“A Day in the Life” from Sgt. Pepper was the first song that came to mind when I read the thread title. Of course it’s attributed to Lennon-McCartney, but the first and last parts are almost all Lennon (“I read the news today, oh boy”) and the middle part is almost all McCartney (“Woke up, fell out of bed, dragged a comb across my head”).
“Behind Blues Eyes” by the Who. Starts and goes on for a long while as an acoustic ballad, but climaxes, introduced by the mightiest power riffs Pete Townshend ever played, into thundering hard rock. It’s one of my favorite songs.
I didn’t think of any of these famous ones. I thought of Anders Osborne’s “Born to Die Together”. It’s a plaintive, semi-up-tempo darkly romantic ditty that turns into a straight up fuzz-box dirge a third of the way through and drags you, wailing, to the end 10 minutes later.