Yes. As far as anyone can tell, a dying person can hear you well past the point where they can answer, and probably right up to the end. Hearing is widely considered the last sense to fade, and there is now direct laboratory evidence that unresponsive dying people still register sound. So say what you need to say, out loud, to the very end.
This is one of the most common and important questions families ask, and the answer is reassuring. For the full picture of the final days, read what dying actually looks like.