Humor is the result of the clash of the incongruous.
It's the intersection of two independent lines of thoughts, incapable of inhabiting the same space at the same time. ("A man walks into a bar. Ouch.")
Every comedian knows this. And this is why comedy is so important, because it can function like society's headlamp, effectively 3D-mapping our collective perception, showing the distances between what is and what we've convinced ourselves is.
This is another reason why many people in this world have such a difficult time with comedians, because comedians have always been watchdogs for bullshit. (Looking at you, Fox News.) And why topics like religion have always been comedic gold, because religion -- just like politics or airline food -- is, at its core, incongruous with reality.
That's why there's no such thing as "offensive" humor. Only a personal reaction to a concept or idea with a kernel of truth which some have made the conscious choice not to accept.
Humor, on the other hand, doesn't care.
Because humor cannot exist without truth.
This is why comedy will always hold so much power. Because if a joke works -- but you don't like it or don't agree with it -- then ultimately it is your belief system that is dishonest; it's your worldview that is what's out of step with reality.
And that, to me, is offensive.