Heartworms are spread to dogs through mosquito bites. Up to 14 inches long, a heartworm lives in the heart and the arteries that carry blood from the heart to the lungs. Heartworms affect how the heart functions and how blood clots and is likely to cause death if untreated.