It helps to think of dialogue as just ordinary conversation – that has a purpose. Monologue is a conversation one has with oneself. Dialogue is a conversation one has with someone else. There are always at leat two people involved in a dialogue.
Your task as a writer is, through the voices having the conversation, to allow your readers to glean more about the characters, their relationships, and their intentions. Sometimes you can also use dialogue to move the action forward, or to reveal something by ‘showing not telling.’