One of the major parts of any story is dialogue (when characters communicate with one another verbally).
Dialogue serves a number of purposes. It is a simple way of communicating information to the reader while also communicating that same information to other characters in the story. That means it can save having to first present the information as the author directly to the reader in the form of description of circumstances or events by having one character convey it to another while engaged in conversation, more or less serving multiple purposes at the same time.
It also can provide tremendous insight into the nature of a character because of how they communicate, the words they use and the attitude with which those words are spoken.
Having been an actor, I had a great deal of experience attempting to speak a character's words and it quickly became apparent that a great many authors have no idea how actual people communicate. The result was a considerable amount of dialogue that was, essentially, "unactable" (so unnatural as to be rendered virtually nonsense when spoken.)
In my initial dramatic works (stage plays) virtually everything the audience learns is communicated through dialogue so I had a long time to work out how to communicate particular and specific information from one character to another (and thus also the audience) in a way that an actual human being would speak.
First you need to understand that people do not actually communicate with words. Words are merely the tool we use to communicate our thoughts and feelings. In fact, when we begin trying to get a thought or feeling across to someone else, we very rarely have a clue what exact words we will use until we shape that thought just before we actually vocalize it. Mostly we rely on our cultural and social standard, taught to us as we slowly learn the language. Much of the time we learn how to express ourselves verbally simply because, when we first realize we can communicate with words the things we think and feel, we will say something like "Want cookie". Inevitably someone (a parent, teacher, etc.) will correct us by repeating back the "proper" example of expressing that thought, such as "I want a cookie", adding the more specific shaping of the concept. In that example we are told to both identify the source of the desire (the "want") as being ourselves, and add the qualifying singular ("a") to clarify the amount of our desire.
In most cases we are not, at that moment, educated as to the syntactic structure being imposed on us (why to add the "I" and "a"). We are simply instructed that it is the proper way to express that desire. Only later, in a formal educational setting, do we learn what those parts of speech are and how they are to be used for clarity of communication.
What I discovered (after much trial and error) is that people actually communicate using three main categories of thought: information, poetry and bullsh*t.
As an author approaching your dialogues using this three category structure can help your character's dialogues natural and believable, while at the same time communicating to the reader the character's thoughts and feelings, as well as subtleties of information in a way the reader is already trained and experienced to understand.
The goal must always be for the reader to be able to "hear" the dialogue being spoken in their own heads and it must sound like something an actual human being would say, rather than expose the author's clumsy attempt to get across thoughts and ideas the reader needs to know but in a way it is obviously being done only to enlighten the reader at the expense of characters who are believable.
INFORMATION
In a story this is often called "exposition", basic facts about the universe in which the story is taking place or the communication of events or other data not outlined elsewhere in the story. For example, an author can have a character make a vague reference to some past event that is important for the reader to understand while not having to "break" the "conversation" and stick in the author voice to bring the reader up to date on what is being discussed.
The character might ask another character "What does Charlie have to say about it?". In order for that statement to make sense, the reader must already know who Charlie is and how they relate to the topic at hand.
The author may have the character use the statement "What does Charlie, our old friend from college, have to say about it?". While that does communicate the necessary information it is not how people actually talk to one another and makes the dialogue awkward and unnatural. Both characters already have a full understanding of who Charlie is and would never waste time and energy repeating what both already know.
There are a number of ways the author can communicate who Charlie is that are, in fact, exactly how it would occur in "real life". One might have the character say instead "You know, back at school Charlie ran into this all the time. I wonder what he would think of it." That not only is something actual people might say, it also instantly communicates to the reader who Charlie is in relation to the topic at hand.
The goal is for the author to be able to actually vocalize the words of the character and accept them as the way actual people speak.
POETRY
A great deal of dialogue falls into this category, which encompasses most expressions of the character's thoughts and feelings. It does not convey necessary factual information, but rather the character's emotions, attitudes and unique points of view about the topic in question.
It does not have to be "poetic" in the sense of restricting the language the character uses to some structure. It simply means that the information being discussed is well known to both characters (as well as the reader) and need not be repeated. In fact, by knowing what is being discussed, the reader will have already determined their own feelings about that information/event. They can then use the words the character selects to demonstrate how they think and feel about that topic is an expression of who that character is, perhaps disclosing information about them that would or could not be expressed anywhere else.
An example would be a character who is otherwise presented as strong, stoic and resolute, thus leading the reader to assume they understand that character's basic nature. But somewhere in the story, perhaps at a moment of stress, the character might admit to another character that he actually hates having to do what he had already been seen doing routinely without, apparently, a second thought. That confession can have a tremendous effect on how the reader sees that character thereafter.
BULLSH*T
BS dialogue might seem essentially worthless in that it does not advance the story, convey specific information or clarify the nature of the speaking character. But what it does do is helps fix the whole story in a universe that is recognizable and familiar to the reader.
The purpose of BS dialogue is to cause the environment of the story to simulate what the reader would experience in their own world. When one first encounters something they might know, what is the first thing they say? Is it not usually an expected salutation to indicate a basic acknowledgement of that other person, such as "Hi, how are you?" Very rarely would one person step up to someone and skip over that greeting, unless the topic is so important one chooses to give up that "expected social standard of expression and behavior". And when one does skip such "niceties" it alerts the reader that something of note is taking place.
This is not to say that any dialogue needs to be neatly broken into only one of these three categories. Most of the time what we say is a combination of all three, to one extent or another.
We can speak in informational BS, poetic BS, poetic information or some mix of all three. But it can be very helpful to know exactly which categories the words being spoken by the character belong to and thus how a real human being would express them in the given circumstances.
Ultimately the point is that the character speaks like an actual human being, so that the reader can believe they are real, and understanding these parts of communication can be very helpful in finding ways to get across everything the author needs to while shaping characters that are understandable and relatable.