Heartgard is a popular brand of heartworm medication for dogs that contains ivermectin as its active ingredient. It works by killing the immature larvae (microfilariae) of the heartworm parasite before they have a chance to develop into adult worms that could damage your pet’s heart and lungs.