We need new medicines; treatments for cancer, Alzheimers, antibiotics. So using the skills and knowledge of clever people, and quite a lot of luck, new medicines are designed.
By the way, it's illegal to use animals for testing cosmetics in the UK (and other European countries). So what we're talking about here, is stuff that's intended to be used as medicines.
Would you like to be a person who takes a drug straight from the lab and try it out? No, neither would I. Remember Thalidomide.
New drugs are tested carefully. You start off with tests in a petri dish. an antibiotic (for example) is introduced to a culture of bacteria. Hopefully, it kills them, because if it doesn't, it's not so useful. And you try it on cultured cell samples. If bad things happen to your cell samples, the drug fails, end of story. Then you might tries flies or worms. Then you might try it on mice. If it tends to kill your mice, well, that's bad, but at least it's only a mouse. Or a rat.
Most of the animals used in testing are invertebrates (don't have a spine); mostly flies and worms. Amongst vertebrates, about 75% of animals used for testing are mice or rats.
So do you go straight to humans? Probably not. You might try it on dogs. We all love dogs, but what's the alternative, cats? Lots of people like cats too. So what, go straight to humans? Before you've checked out the drug on significant group of large mammals? And, at the same time, you're determining what would be an appropriate dose, because scaling up the dose from a one pound mouse to a 200 pound human isn't just a matter of multiplying by 200. And it's important to know what the right dose is.
That's why we breed dogs for drug testing. Because it would be difficult to use any other large mammal (cows, horses?). And almost impossible, and very unethical, to get together a group of 100 humans to use as test subjects for a new drug that hasn't been previously tested on animals.
I know it's not a popular idea to use dogs for drug testing. The problem is, the alternatives are worse.