This is a great question given many people tend to not understand the difference between listening and hearing.
Hearing is defined as the ability to recognize sound. This can be conversation, music, background noises, etc.
Listening is very different. To listen, one must make a conscious effort to pay attention to and try to comprehend what is being said or heard.
The problem with the two different words is that sometimes people use them interchangeably. Unfortunately, the acts of listening and hearing are very different.
For example, many students hear a teacher speaking. Instead of listening though, they are only conscious that words are coming out of the teacher's mouth and nothing more. It is also like having music on for background noise--you can hear it, but you are not paying attention to what song is playing or the lyrics being sung.
Listening is very different. When one listens, they are taking note of what is being said so as to comment back or remember the information being given regarding one thing or another. One is truly listening when they are focused upon what someone is saying and can repeat or answer a question posed.
Therefore, when one asks if you heard them, you can answer "yes" if you know that they were speaking, but failed to focus upon what was said. Instead, one should ask if they were listening. This question would pose a very different answer many times given they are poignantly asking if you comprehended what they said.