It’s a preface used for: “What I’m about to say is meant as an insult.”
Not always. My grandparents used it as an endearing phrase. For example, say when I was little I did something cute or sweet, they would say “ Why bless your little heart”. I don’t think I ever heard them use is in a sarcastic way, but they were from the deep South and all of my family used that term a lot and in a nice way.