When a baby has a pacifier in their mouth at night it helps to keep their mouth open and sucking in air which is one of the reasons it prevents SIDS.
Babies usually die of SIDS due to suffocation and not breathing properly and as the baby sucks on the pacifier their mouth is kept partially open enough to allow them to breathe.
And that sucking motion keeps them breathing in the air so it's a good thing to allow a baby up to a year old to have a pacifier at night.
After a year old the baby really doesn't need a pacifier but it's okay if the child is using a pacifier at 2 and 4 years old but once they reach 4 years old the pacifier should be gone at least during the day.
My little brother used a pacifier at home during the day and night until he was 10 years old and he finally gave it up on his own.
My parents didn't make a fuss of it and I didn't make fun of him either nor did anyone else.
He was too embarrassed to use the pacifier in public after age 5 but at home he was content with using the pacifier so my parents let him.
I gave my pacifier up at age 3 and couldn't see why my brother wanted his pacifier until 10 years old but It didn't really matter.