The single best piece of writing advice I ever got was from a professor teaching a playwriting class, who told us that in every scene, especially scenes that were just dialogue, every character should want something. Making every character in a scene have a goal is an easy way to avoid dialogue that’s just exposition, and to make sure your dialogue drives the plot forward and/or reveals characterization.
It doesn’t have to be complicated or super weighty–as long as the characters have a goal, there will be tension in the scene even if the goals are small. Character X wants to borrow a pen, and character Y wants to make a good impression on character X. X wants to insult Y until they go away, and Y wants to annoy X by pretending not to notice the insults. X wants Y to give them the last slice of pizza, and Y is super full but still doesn’t want X to have it. No matter what your character’s goal is, it will reveal something about who that character is to the reader, and the conflict between your characters’ goals will give the scene momentum.