Any filter on your lens provides some mechanical protection. Many people always use at least some filter for this reason. It's better to scratch a $30 replacable filter than a $300 lens. A UV filter is often used when you otherwise don't want a filter at all. It blocks the UV rays you can't see, but which the lens would focus differently than visible light and which the sensor or film can pick up.
A polarizing filter does not prevent damage to the sensor from direct focused sunlight. It does attenuate the sun by a little more than 1 F-stop, but that is a small amount and not much help in preventing the sensor from getting fried.
A polarizing filter also does not "prevent glare". What it does do is only let light thru that is at a particular polarization angle. When the light is randomly polarized, then it will pass only half the light in theory, which is where the 1 F-stop attenuation comes from. Of course real polarizing filters aren't perfect, so you get a little more than 1 F-stop attenuation.
A polarizing filter only matters when some light in your scene is polarized, otherwise it is just a roughly 1 F-stop neutral density filter. In nature, polarized light is usually a result of reflection off a dielectric at the right angle. Examples are reflections off the surface of water, shiny non-metal (hence dielectric) surfaces, and part of the sky light at some angles to the sun. At a specific reflection angle, all the light is polarized.
A polarizing filter can be rotated so that you can decide what polarization angle you want to pick. Depending on how you rotate the filter, you can accentuate or attenuate reflections off of water, for example.
Polarized sunglasses have polarizing filters aligned such that the polarized reflections off of horizontal surfaces (assuming you are holding your head straight) are blocked. This is useful in many situations because part of unwanted glare are reflections off of horizontal dielectrics. This is particular the case when driving. Examples of polarized reflections attenutated by such sunglasses are the reflections from the inside of your windsheild, reflections off of polished horizontal surface like your hood or the hood of other cars, and reflections off the wet road ahead of you.