Double sided foam tape is made from two layers of thin foam with adhesive on both sides. It's available in a variety of widths and thicknesses, so you can tailor it to your needs. And because the adhesive is already applied, all you need to do is peel off the backing and stick it in place.
One thing to keep in mind when using double sided foam tape is that it doesn't always provide a strong bond. If you're using it for something that will be under a lot of stress or strain, like mounting a heavy mirror, make sure to use additional fasteners just to be safe.