It depends on certain factors, like the sounds we use, intonation, familiarity with the words or sounds, and our body language. But their ability to make complex connections is severely limited.
In 2016, a study in Hungary showed the left hemisphere of the brain is used to processmeanins of words, and the right side works out intonation exactly the same way humans process language. Dogs can pick up when we're not consistent in our language & tone, in other words. A “Good boy!” vs “Good boy,” is very different to them, because the first one activated the reward center (an evolutionary mechanism that gives pleasure and tells us to do that again) with praising words in a praising intonation.
Yeah, but can they really learn what we're saying, like sentences and stuff?
On average dogs can understand 165 words, but with consistency and training they can understand more. If you say sit the same way every time, it becomes clear to a dog quickly what you want after you have praised them.
What don't they get? Abstract concepts, long words, and complex connections. They don't listen to the whole sentence, and some science suggests maybe not even the whole word but just the first syllable. To fill in big gaps of information to help them determine what we want, they look at our body language even more than listening to us. Hand signals are just as effective at training as words, and puppies can follow a pointed finger just the same as human babies.
They can tell when we are upset or angry by looking, but almost never know why we are angry. That's why dogs don't stop doing things that make us irritated; they can't make the complex connection between them getting into the garbage and our anger. They would know at most that when the garbage can is on the floor, you are angry. Garbage on the floor doesn't register with dogs as right or wrong, because they don't have that concept.
Can we use this to our advantage? Of course! The more we understand about how dogs see and hear us, the more we can refine how we communicate back to them. With communication comes more understanding, and a stronger connection and bond.