What does ese mean in slang?

I know it is the Spanish word for that, and it also indicates “he” or “you” (male, I guess – can you specify gender?).

But what does it mean when two guys say it to one another? Is it just like, “dude” or “bro” or “man”?

Yes it is simply slang for “dude”, “man” etc. predominantly in the mexican-American communities of the far west. Apparently a middle-ground between vato and cholo. Some interesting origin theaories are presented at the Urban dictionary.