IV drugs are really bad on your valves, cocaine is a stimulant like MDMA, hard to say which is worse though, I'm more likely to use a large dose of MDMA then coke myself.
As a fairly strong stimulant, MDMA places a strain on the heart (similar to vigorous exercise.) For reasonably healthy people, occasional use shouldn't be a problem.
There is good reason to believe that heavy, long-term use of MDMA could cause heart problems (particularly valve abnormalities) in some people, so if you want to get high every weekend for a few years, you may be increasing your risk of a heart attack. (Of course, that sort of heavy usage will also almost certainly screw you up psychologically, so it's a bad idea all around. )
Cocaine is worse on the heart.... that should be a given. Although mdma is still a stimulant the strain on the heart is lighter than others unless you by chance have amphetamine or meth cut into your pills.