Often two enemy trenches were very close to each other? Who dug them? Were soldiers killed while they were building the trenches?
Soldiers were equipped with entrenching tools and in the first instance could dig their own trenches.
Your question about the trenches being close and people potentially being killed implies that the forces would settle on a position, then begin digging the trenches. In fact where the trenches were so close, they would have started further back and then been advanced by extending an existing trench.