They both could be used interchangeably in many cases to give permission in a polite way for example:
"Can I use your cellphone ?" "Of course, you can." or "Sure, you can."
You can use both. 'Of course' means it is a normal thing ,it goes without saying .It emphasizes someone's agreement "of course" or disagreement " of course not".
'Sure' means it is definite, certain and free from doubt. It emphasizes that something (using the phone here) is reliable. It is also many times just an informal way of saying 'yes' or 'all right' .
Of course is used say that something is obvious. Is Bill Gates rich? Of course he is. Does a bear shit in the woods? Of course. For sure means definitely, or without any doubt (undoubtedly). You could certainly say "for sure" as a response to that question too. "Are you going to the party?" For sure. Without any doubt