Great question! Let's first break down the actual definitions of each of these terms:
Humor: The dictionary defines humor as "that quality which appeals to the sense of the ludicrous or the absurdly incongruous," or more simply, "something that is designed to be comical or amusing" (Merriam Webster). There are two important takeaways here:
Humor has no specified form. It could be visual, literary, nonsensical, sarcastic - anything at all! It is also highly dependent on the cultural context of the subject, or person who finds a thing humorous.
Humor is inherently related to a thing that is funny. Its actual definition requires that it either be intentionally funny (designed to be comical) or something unintentionally funny (appeals to the sense of the ludicrous). It matters less about whether or not the humor was supposed to be happening, and it matters more that it is actually funny.
Irony: There are actually three types of irony! Let's run through those first:
Verbal Irony: When a speaker intentionally uses words that mean the opposite of his/her intended meaning (Ex: Spilling my coffee was exactly how I wanted to start my day!). Verbal irony is often confused with sarcasm, but the key difference is that sarcasm is typically characterized by maliciousness, or a pointed negativity towards a person, whereas verbal irony is just stating the opposite of what you mean.
Situational Irony: This is when one thing is expected to happen, but in fact the exact opposite happens (Ex: A psychic, whom you expect to know the future, is killed in a freak accident, which he/she should have seen coming). It's hard not to confuse situational irony with coincidence (thanks, Alanis Morissette, for confusing the entire 1990s) but the key here is to remember that situational irony means the exact opposite, whereas coincidence just means an outcome that is bad luck.
Dramatic Irony: Dramatic irony is reserved specifically for performance literature, like a play or movie. This is when the audience knows something, but the character doesn't (Ex: Watching a horror movie where the killer is hiding in the closet, but the beautiful blonde has no idea, and everyone is frantically yelling DON'T GO IN THERE HAVEN'T YOU EVER SEEN A HORROR MOVIE - and then she does because it's a movie, and she can't hear you). In this case, the character often does what he/she would not do if he/she understood or knew all of the things that the audience knows.
Okay, so what is the difference? The defining features between these two terms are pretty clear.
Humor must be funny
Irony must be the opposite of what is expected or intended
So why the confusion? Well, the answer is: really good writers make this confusing.
Why? Because really good writers use irony to make very funny points. As a result, in most valued literature, irony is inextricably linked to humor. It's only when you really break down what the two words themselves mean that the difference becomes clear.