Not all of the food is actually hit by microwaves. In a microwave oven, the microwaves only penetrate an inch or so into the food, and the intensity falls of as it gets deeper into the food. On the other hand, bacteria typically are found only on the outside of the food.
However, the microwaves are heating up the food, and heat can kill bacteria and mold. But again, not all of the food in a microwave necessarily gets hot enough to kill bacteria.
If you are concerned about bacteria, one way to help take care of it is to add a teaspoon or so of water to the dish, and then cover it with plastic wrap. The water will turn into steam, which is a very good bacteriocide, and which can permeate the food better than simple heat can.
But if the food was stored in a refrigerator, and hasn't been allowed to stay at room temperature very long, and especially if it doesn't smell bad, you are probably fine.
By the way, bacteria and mold aren't universally bad for you. In fact the vast majority of bacteria are neutral, and some are necessary for your health. A whole lot of bacteria lives in your gut, helping digest food and ward off stomach cancer, believe it or not. They are called "probiotics. Any bacteria that kills the animal it is living in won't last very long.
Mold is a little different, since mold doesn't typically live inside your body. But even so, most mold isn't bad for you. In fact you often eat various types of mold and yeast in your food. Mold can cause problems for you if it happens to create substances that your body finds toxic or allergenic.
But again, your body has all sorts of mechanisms to help you fight off these pathogens. They are working day and night, without your knowing, and they generally work very well.