This is called parsing - your brain processing the speech sounds into meaning. That feeling of suddenly realizing what was said is your brain needing a little extra time to parse.
This can happen for lots of reasons. One time my sister in law was so grumpy that my brain struggled to parse what she was saying because the tone and words were so mismatched.
This happens to everyone. It happens because your brain registers the other person saying something before it actually understands what is being said. And when most people don't know what someone said, they ask, "what?" without even thinking. Source: my intro to psych textbook.
I've caught people doing this before but I never say anything because I don't wanna have to explain to them why I can suddenly recall something I didn't hear
I usually do this anyway to a certain extent, at least I kinda rephrase what I said, in case them asking 'what' wasn't because they didn't hear me but because they didn't understand. Then if their brain does catch up they get two different versions of my message :)
Quick solution: when you don’t understand what someone just said, wait a few seconds before asking what. Often, your brain will fill in the gap given a second to catch up.
This happens quite often to me, especially when tired. I'm assuming that for me it's mostly autism related. That being said, I've noticed that many non-autistic people also have this happen every now and then., it just happens more for me.