In certain places at the front in WW1, trenches were sometimes 20m from each other. How were these trenches made, i.e. how were they dug, reinforced, supplied, etc when the other side was 20m away? One side must have been there first, no? If so, couldn't they shoot those building the trench on the other side?
The trench lines evolved organically and not often in a planned manner. This meant that the trenches were dug when the opportunity presented itself. Where trenches were dug in particularly close proximity to each other likely indicates a meeting point of two forces with shallow pits being dug hurriedly to avoid incoming fire. Over time, those shallow pits get deeper as the occupant tries to get as far below ground level as possible and connect to neighbouring pits to allow troops to move around. Eventually, they are incorporated into the larger trench system. Additionally, large shell holes are good cover and could also be incorporated into a defensive system.
In preparation for larger offensives, trenches or saps would be dug perpendicular to the front line so attacking troops could be closer to enemy lines when they had to emerge from the protection of their trenches.
The other point to note is that both sides developed trench systems. You would have the front trench which was quite literally the front line. Behind that, running roughly parallel was the second trench, the support trench, and behind that again would be the third trench, the reserve trench. These three trenches were connected at intervals by communications trenches which enabled the cycle of troops at the front line as well as, well communication to get to the front line, food, ammo etc etc.
The support trench also gave front line troops somewhere to retreat to temporarily at times when the front was being bombarded by artillery, or if the enemy appeared over the top.
I've not personally heard of these systems being as close as 20 metres though, I thought it was more like 100 or so metres.
However, when they "went over the top" to attack the opposing trenches, they might find themselves occupying what was previously the enemy front line, without penetrating deeper into the support trenches, thus your new front might end up relatively close to the enemy front, without necessarily having to dig in front of them