The phrase, 'Bless you!' is short for 'May God bless you!'
There are two main ways in which it is used in modern conversation.
Firstly, as you point out, people say it when someone sneezes in their presence. As I believe the two uses are related, it's worth looking at the first in more detail.
In her book, 'Are You Superstitious?', Lore Cowan writes:
Some folk still believe that with a sneeze an evil spirit is forced out of the body. Others say it goes back to Prometheus, who stole heavenly fire from Olympus to animate his figure of clay, and caused the figure to sneeze, which prompted Prometheus to invoke a blessing on it.
A more prosaic reason is that the Romans brought the custom [to Britain]. They regarded the sneeze as an indication of illness or the plague, and so asked their god's blessing on the sneezer.
One other origin: It is said that in early biblical days a sneeze was a portent of death, and that it was to Jacob that God promised that it would no longer be such a tragic omen.
The phrase is also used in a variety of other ways: caring, condescending or ironic (which is what you're asking about), for instance:
Ah! Bless your heart!
(Could be spoken in genuine gratitude - or condescendingly, or ironically when the intention is not to bless, but to deride.)
Oh, bless her little cotton socks!
(Could be spoken in genuine admiration to a new mother about her newborn child - or rather condescendingly to pinpoint precocious behaviour.)
In the second case, if the intention is genuine, it would be used superstitiously and prophylactically to avert the 'evil eye' (as is the custom around the Middle East and Southern Europe); if used condescendingly or ironically, then it would still have a resonance with the conventional superstitious usage that lies behind the evocation of a blessing when someone sneezes.
We may not be aware of the historic resonances, or the reasons behind superstitions, but we carry them in our language use and culture, and it's questions like this that make us look at phrases like this and help us see them in a new light.