How close can you get to enemies before having to roll stealth?

The following situation: 2 Members of the party try to sneak up on distracted enemies. The other two, not stealth proficient players want to stay 20 feet behind, not roll stealth and join after the others. The approach is fine by me, but I am really confused about how near they can get before being noticed. This is important because I need to know how long they will take to join the fight afterward.

If I had to guess, I would say there is a detection range, how far a creature can detect others. Is there any rule for that or does the DM have to arbitrarily decide every time? Also, how does the alertness of the detecting creature and the environment (i.e. reverberation in a dungeon) factor into this?