Depends I guess,
In any situation I would hold the door open for a woman no matter how many steps away they are. They are smaller and weaker with less muscle mass within their arms, so it is just the polite thing to do.
If it were a man,
I would stick within the five steps away radius.. unless it looks like you are each going to reach the door at the same time.
In that case, speed up and open the door first. It shows class, and they have to say thank you.. and it is a plus if they have a woman with them, because they have to show respect and say thank you. And if they don't, they end up looking like a douche in front of their girl...