Photons go on for ever unless they hit something and space is pretty empty. So unless there is a grain of dust, or a star in the way a photon will travel across the universe.
Paradoxically it's harder for high energy photons such as x-rays to travel large distances in space. Because of their energy they can be effected by passing close to even something as small as a single electron.
The other reason we still don't see X-ray objects at the same vast distances that we see infrared sources is that, even with Chandra, x-ray telescopes are smaller and less sensitive than optical or radio telescopes and so we need more photons from the source, so it needs to be brighter or closer.
The reason distant objects are fainter isn't so much that photons are blocked - it's that the photons spread out into a sphere. So at 2x the distance away they are spread over an area 4x as big and so are diluted.