Gravity, according to our current understanding, does have a range. Gravity is described by Einstein's theory of general relativity, which states that massive objects curve the fabric of spacetime, causing other objects to move along curved paths. This curvature of spacetime extends infinitely, theoretically reaching out to an infinite distance.
As for your question about galaxies moving away from us at speeds greater than the speed of light due to the expansion of space, it's important to note that the expansion of space itself does not cause objects to move through space faster than the speed of light. The expansion of the universe refers to the stretching of space between objects, rather than the motion of objects within space.
The phenomenon you're referring to is known as the cosmological redshift, which occurs due to the expansion of space between distant galaxies. As galaxies move away from us, the light they emit is stretched, resulting in a shift towards longer wavelengths (redshift). As the redshift increases, the apparent recession velocity of the galaxies also increases. However, it's crucial to understand that this recession velocity is a consequence of the expanding space and not the galaxies' actual motion through space.
Regardless of the apparent recession velocity or the distance between galaxies, gravity still operates between them. The force of gravity weakens with distance according to an inverse square law. Even if two galaxies are extremely distant from each other, there will still be a gravitational interaction between them, although it will be significantly weaker compared to closer objects.
In summary, the expansion of space and the apparent recession of galaxies do not negate the effects of gravity. Gravity's influence extends over vast distances, and even galaxies that are moving away from us at speeds greater than the speed of light (in terms of cosmological redshift) would still exert gravitational effects, albeit weaker as their distance increases.