Your question is very hard to answer. Especially my English is very poor...
There is no bad pipe or good pipe. There is only fitted pipe. The only way you have to try different pipe then you will know which one is the best(fitted) to your purpose. So...There is also no correct "distance", it depend on the track and engine. Remember it is named TUNED pipe.
In general,longer tuned pipe has better torque but has limited max rpm. Shorter pipe has less torque but has better max rpm. So if the track needs a lot of high end you can choice short pipe or short manifold. If there is a technic track,a long pipe will be good.
Most racers have a lot of different pipes. When they be a new track they will do some tests to find the fittest one. Sometimes they only change different manifolds for the in-line pipe. Different headers have different effects.