Both words seem to have the same meaning, but ‘afraid’ sounds more formal than ‘scared’.
The authorities are afraid that the bridge might collapse due to the flooding.
I’m scared of ghosts!
A sentence like ‘I’m afraid I will not be able to come to the party tonight’ is used as a polite way of showing regret when you decline to do something. The use of the word ‘afraid’ in this manner is typical of British English only.