Anime is Japanese animation.
Cartoons are Western animation.
That's the only real difference in terms.
There have been members of both groups that have taken on similar styles to the other. But that still doesn't make Avatar an anime or One Piece a cartoon. They are both animation, however.
As for the subject matter, what does it matter to the discussion? Both cartoons and anime have explored all sorts of subjects for children and adults. Just being from Japan does not automatically make any given anime "deeper" or "better" than a Western cartoon, nor does it make it worse. Sure, Western animation tends to put more of a focus on comedy, but that doesn't mean you won't be able to find some serious Western animation out there.
On another related topic regarding anime, I just had an interesting thought. I have a theory about one reason why you see more "serious" subjects in anime. I think it partly has to do with a good way of putting fantastical elements of a story in motion picture form. Take adaptations from comics for example, as a great many anime are manga adaptations. There is no shortage of such adaptations in Western or Japanese film and TV. However, you'll notice that a large portion of Western comic adaptations are live-action, no matter how fantastical the plot line. Name any well-known Marvel or DC superhero, and they will likely have had some live-action TV or movie adaptation at some point in the character's history. These range from more "realistic" superheroes like Batman or the Punisher, to the really out-there heroes like Thor or Green Lantern (both of which are coming to the big screen later this year).
In contrast, Japan only seems to adapt its more "realistic" manga to live action. Stuff that would require a large amount of effects or CG to pull off seems to be passed to animation. The easier it is to stage in live action, the more likely it is to be so. Fantasy creatures, magic, giant robots, "power levels", crazy "jutsu", you name it, tend to be adapted into animation. Take Death Note, for instance. It has both an animated and live action version, and I would guess that this is partly because you don't need a big budget to pull off creating it in live action. You just need to stage some deaths and create a CG shinigami. On the other hand, a faithful production of Dragonball Z requires a lot better job with the details of it than Dragonball Evolution pulled, that's for sure. Adapting such stories into animation allows for more faithful adaptation of the source by being able to produce angles, effects, and basically creating whole worlds for the story that would be impossible even by today's standards in live action. Not to mention being able to produce the project under a more limited budget constraint, which is one of the major reasons anime is done in its unique style to this day. Whereas Hollywood has the money and resources at its disposal to take a world like that of Harry Potter and make eight full-length live action films out of it, and to a high standard of quality as well (relatively speaking). I'd like to see any Japanese film studio do that.