cosmological principle states that, on large spatial scales, universe is homogeneous and isotropic. in other words, universe looks the same in every direction and that is true for every point of view. there are some challanges to this principle, but for this discussion, I will assume it is correct.
so, let's start.
on the following picture we can see: a source of light (laser), a ray of light and a receptor. this is hypothetical setting, so, i will assume that a source and receptor are massless, so there are no gravitational fields here.
pic1:View attachment 13682
we see, ray of light, following a straight line and hiting earth.

next example is a bit more complicated because ray of light travels through universe. but according to cosmological principle universe is homogeneous and isotropic on large scales, and our ray of light traveles great distance so we can apply the principle.
pic2:View attachment 13683
ok, what do we see on pic2?
on top we see universe and gravity presented with the same shade of gray. but why did I do that? I did this because I simply applied cosmological principle on this ray.

on bottom part of pic2 we can see it in 'reality'. I used this beautiful picture of omega centauri to represent the whole universe. here yellow line isn't really 'straight'. I used a straight line only to approximate the path of light. what really happens is that this line bends as light travells through gravitational fields of different strength (gravitational lensing). but, since universe is homogeneous and isotropic I can assume this local bending will be 'straightened' with another bending, but in different direction, providig that this ray of light travelles large distances. so, at the end, its path can be approximated with a 'straight' line.
and this we can see on pic3.
pic3:View attachment 13684

and fially - my question is:
can we approximate path of a ray of light through universe with a straight line, providing that the ray traveles large distance?

Viewed from a comoving frame, a light ray will travel on a perfectly "straight" line (geodesic) if the spacetime is flat: i.e., it doesn't pass through a gravitational field and the background spatial geometry is perfectly flat.

On the other hand, if the light ray passes through a gravitational field, then its spacetime geodesic will not be perfectly straight. One can't really say that it is "approximately" a straight line; the total amount of deflection from the original course depends on the intensity of the gravitational field(s) (curved spacetime) it passes through, how close it passes to the gravitational source(s), etc. For example, if the light ray is gravitationally lensed because it passes very close to a highly massive structure (such as a rich galaxy cluster), then the amount of deflection will be noticeably significant.

Or if a light ray strikes an object and reflects off of it, then obviously the deflection could be any amount, even 180 degrees.