As previously noted, the knowledge of bacteria and microscopic organisms did not exist in the Buddha's time. You'll have to excuse me, but apart from encouraging mindfulness about the consequences of your actions, even mentioning the fact that in brushing your teeth and using anti-bacterial soap you "kill bacteria" seems like utter silliness to me. Your immune system undoubtedly kills innumerable bacteria, and nothing you do can ever change that. It is necessary for your immune system to kill bacteria in order for you to live. Identifying this as bad Karma would be similar to saying that you should not breathe.
Similarly, you unknowingly swallow dozens of insects in your sleep over the course of your lifetime. I am a strict vegetarian, but this does not bother me. It is done without malicious intention, or even knowledge of the doing and is therefore, harmless. It is probably impossible to live your life in a way that creates absolutely no animal suffering, even if you are a vegan. You step on insects unknowingly, andch in the harvest of your organic vegetables, countless insects are killed. You should not feel one ounce of guilt for this - the point of vegetarianism or veganism, and, by my understanding, Buddhism, is to lessen the amount of suffering you cause as much as humanly possible, since suffering is an inevitable and unavoidable part of existence.
Furthermore, I can't see how you can condone the consumption of plants if you seriously consider the destruction of bacteria to have any kind of Karmic weight. Although it is true that plants lack any kind of nervous system like multicellular animal organisms do, and that they don't move in visibly notable ways, if one watches accelerated footage of plants they can see that the plant moves in response to light and grows towards it. Also, scientists have been able to gauge a chemical response in plants by lighting them on fire. So while we do not know whether plants experience a sensation akin to pain and suffering, it is entirely possible. The reason why it is not forbidden to eat plants is because it is unreasonable to expect anyone to have this level of pious devotion to the point of self-detriment. I feel abstaining from eating plants and starving oneself, viewing this as the only way to avoid causing suffering, contradicts the Buddha's teaching of "the Middle Way."
However, in my view, killing and performing experiments on animals in a way which causes them suffering (as differentiated from euthanasia to prevent suffering) is Wrong Livelihood, and is not necessarily justified by the argument that it would bring about medical benefit to future people. The medical experiments performed on Jews and other prisoners by the Nazis in their concentration camps have also produced benefits of a medical nature and data that was of use in the construction of high altitude planes, and so forth. But to condone the actions of these men by using the good that resulted from their actions would be considered monstrous by almost anyone. To my knowledge, Buddhism teaches that animals should not be treated as lower, expendable organisms.
I am not trying to condemn you, I am simply saying that in my personal opinion, the end almost never justifies the means, and the fact that you have to ask the question in the first place of whether the ends justify the means signifies it is not something you should be doing. What if you could cure cancer, but in order to do so, you would have to kill a human being in the most horrible, painful manner imaginable? Would this act be excused by having cured cancer and averting others' pain?