Very simply, with heat from above.
I cannot comment on the microwave, since I have almost never used one, but a pan is clearly the wrong tool for the job, since there you are heating the bread from below, and the cheese only gets slightly warmed, if at all.
Using an oven, I have never noticed a need for reducing the moisture, as other answers suggest. The mozzarella straight out of the brine might make your bread somewhat soggy, but there is nothing wrong with that for me.
The best device for doing this will be a grill/broiler, but a toaster oven and a normal oven will also work. All you have to do is slice the mozzarella, place it on the bread, and bake. Place the sandwiches as closely to the upper heating element as possible.
Using this method, I have made sandwiches with up to 1.5 cm thick mozzarella slices. They are quite decadent :) but my point is, the thickness is not a problem at all, nor is the moisture.
Above, a picture of some mozzarella I melted on bread in an oven. It is the high-moisture mozzarella sold in apple-sized balls, sliced thickly. I placed it as close as possible to the upper heating elements, and it fared quite well.