It’s typically a way of expressing anger/displeasure/etc. without turning the comment into a personal insult. If I say “I don’t mean to be rude, but you made a grammatical mistake”, or “I don’t mean to be harsh, but your idea doesn’t make sense” what I mean in the former case is something like “anyone could make that mistake, please don’t take it personally, but I figured you’d like to know”, or in the latter case, “you need to clarify your idea, because you’re losing your audience; I don’t want to imply it doesn’t have any merit, but as currently explained the merit doesn’t shine through”.
Being able to make quick softening caveats without taking up a paragraph is very useful, and our language is more nuanced and powerful for having these constructions.