'Dude' is a word used mostly by younger people to address their peers. I don't know the meaning behind it, but you use it for friends. It is more commonly used between boys, but girls say it too. It would be inappropriate for a younger person to call an elder 'Dude'.
So, use this between people of your age group! but make sure you know them well enough, or it will be weird calling some 'dude' if you just met them.
BUT, since it is an slang, it is really unnecessary to say it! ^-^
Personally, I don't say it because I don't think it's really polite.
(\(^-^ )/)