It is most polite to hold a door open for a person following behind you. Do not, under any circumstance, let the door slam shut in someone’s face.
If you see an elderly person, someone carrying packages, or someone with a stroller or baby, extend a courteous gesture by holding the door for them, even if they are a slight distance behind you.
If someone is so kind to hold the door open for you, don’t forget to thank them!