The closer stars, Sirius for example, don't have any real opportunity for much of anything massive to be between them and us. And they also move over time relative to background stars (and us): only if some unseen mass moved along with them would the parallax - the triangle - stay warped the same way. And then we have thousands of parallaxes on stars out to 100 parsecs or so, and 1) members of clusters have very similar "triangles" and 2) stars whose spectra show them to be very similar are appropriately bright for their trigonometric distances. It would take a very devious gravitational field to make that happen all over the sky.
And then we have a different sort of trigonometric measurement, one of 25,000,000 light years=eight million parsecs, to the galaxy Messier 106. (not English "more messy, but a Frenchman's name....) One side of a central disc is approaching us, and the other side receding, and we know how fast by the Doppler effect, exactly like that cop knows how fast you're driving. Then they used a radiotelescope to see how far, angularly, across the front of the disc several radio-emitting clouds moved over a few years. Those data and high-school trig gave the distance.
It's a big place out there.