If the HWs are very bad, ie large & plentiful - they take several years to grow large enough to be life threatening, heart damage can result. When they're killed with the Ivermectin, they break up into pieces in the bloodstream. This is why dogs being treated must be kept quiet for a while, because they can get a fatal blood clot, but this is quite rare as long as the owner is careful. And if you've paid the bill for treatment
you WILL be careful! It's expensive. I paid about $800 USD, I've heard of vets charging much more, and some less.
The treatment kills the worms totally. But any dog can get re-infested by mosquitos, which is why dogs really should be on HW preventative unless you live in the North Pole where there aren't any skeeters!
Dutch's heart is probably OK, but the dead worm bits get carried into the lungs. So some little bronchial thingies (sorry, I'm tired) can get plugged up for life, and the dog gets less oxygen. I guess in the long run this isn't good for the heart either, that's why I somewhat restrict his exercise! He gets lots, but I don't let him play or run to exhaustion.
Dogs with a mild infestation usually recover 100%. Dutch's was "moderate" according to the vet.
Here's a good link:
A friend had a Great Dane who had mild HW when she adopted him. "Thunder" lived to be 12 years old which is amazing for a Dane!