It would help to have examples of what you have said that has offended people. Generally people don't like to be criticised and told things that although true could cause embarrassment or offense, such as commenting on someones weight, how they look, or challenging what they have said, especially if it could constitute a personal belief of theirs, like telling people they are stupid to believe in God, for example.
People like those who they see as 'like them' and 'think the same way they do', as in they share the same beliefs, interests and views. It is also true that you should speak differently to someone who is a stranger then you would to a friend. Generally you are allowed to be more honest and frank with a friend as they will know that you have the best of intentions in mind and that what you say you say as a good friend who feels they should know the truth.
I'm certainly no expert as I find myself in arguments all the time and a lot of the time I have no idea how they started or what I said that was wrong. But overall the best way to combat it is to always be nice to people and surround yourself by people who are nice also. And always make sure you are listening more than you are talking. A big aspie trait can be to go on and on about a subject of interest, which is a bad idea. However if you listen to others, even if they are going on and on themselves and show a genuine interest, you will find they take away a better opinion of you than your words could have ever given them.