Veterinarians recommend giving animals heartworm pills to prevent a heartworm infection, which can be expensive and difficult to treat. Treatment after a dog is infected can be far more expensive. In the US, there is only one heartworm medication approved by the FDA, and it can have negative side effects on the dog.