Dialogue is one of the hardest things for writers to write and a difficulty that is not exclusive to new writers. Finding your characters' individual voices is extremely difficult, and more often than not, they end up sounding just like every other character in your story, which then makes it difficult for your reader to determine who is speaking when. Especially if you have two characters that are already very similar. For example:
Bob and Dillon are brothers, three years apart, in their mid-twenties. Bob is a lawyer and Dillon is an aspiring professional skateboarder.
"Hey, we need milk. Could you get some on your way home?"
"Sure. Do you have a preference?"
"2%, but I'm supposed to be cutting fat. Get skim."
Could you tell who was who? How about in this one:
"You left your room a mess. Again."
"You're not Mom, bro. Chill out."
"I may not be Mom, but for the time being, you're living in my house. If you don't like it, find your own place."
"Are you seriously kicking me out?"
"I'm not kicking you out, I'm just asking you to be more considerate."
Now, admittedly, the scenarios are very different. However, if you know your characters well enough, the subtle differences between them should unfold in even the most mundane dialogue. So let's revisit the first example and see if we can make it clearer:
"Would you mind picking up some milk on your way home?"
"I guess. You got a preference?"
"Skim. My doctor says I need to cut back on fats."
That still wasn't extremely clear, but you should at least have a slightly better idea of who is speaking. If you're still confused the rundown is:
World Building will help you a lot in establishing believable characters. If you know your character's individual world (i.e. what they do for a living, where they went to school, who their friends are, etc.) then the way they speak should unfold naturally.