One other thing to consider here is that no matter in space moves in a straight line. Even light itself, which we think of in terms of “a beam” or “a ray”, meaning something linear, is curved in space. All of the “stuff” of the universe revolves around “other stuff”.
To put some perspective on this, the Earth has been revolving around the Sun for several billion years and hasn’t run into it yet.
So the example of “two planets colliding” probably means that they were revolving around a common star of their own – maybe even our own Sun – and the fragments that were ejected continued to revolve, albeit in a somewhat different orbit after the collision, around the same star. Even assuming some kind of forces that would have propelled your hypothetical fragment into some kind of escape velocity, the path taken would have been a helical one as the fragment spun through space over those billions of miles. It could have (I expect “would have”) spun in a more and more eccentric orbit for billions of years before it managed to escape.
So there’s absolutely no way of knowing “how far away” this could have happened, although I like @gasman‘s assignment of an absolute limit on how far away it could have been. Since that assumes some sort of “straight line” travel (and remember that the Earth itself and the Solar System it resides in are all in relative movement, too) that distance could be considerably longer if the Earth’s movement in the intervening years has been toward the location of the collision… and if everything was traveling in straight lines.
Or, as @LuckyGuy has suggested, this could have occurred (in galactic terms) “next door”.