There are a few different possibilities for the idea that "$G$ is a function": it could be a function of space and time, it could be a function of mass, or it could be a function of separation between the two masses.
This answer will exclude the case of extremely high masses, because we already know Newtonian gravity fails in that regime, and general relativity is needed. This answer will also exclude the case of extremely small separations, because we already know an as-yet-undeveloped theory of quantum gravity is needed to describe that regime. (This restriction actually unfortunately excludes one of the greatest tests we have of the constancy of $G$, namely, the slowing of the rotation rates of pulsars as they emit gravitational waves, but you seem to specifically be asking about Newtonian gravity, whereas that is purely a result of general relativity.)
It's also important to note that any measurement can only impose limits on how much that $G$ could change, and it's always technically possible that there is a subtle enough variation in $G$ that current measurements will not be able to detect it. This is why the concept of a "proof" that $G$ is constant everywhere is largely not something that can be reasonably expected. There is no evidence that it is not constant, and we have observed that it's constant to within certain limits, but asking for a proof that it's exactly constant under all circumstances is asking for a measurement with infinite precision. The constancy of $G$ is something that can only be disproved, if it is someday observed to vary. As of right now, we assume that it is constant because 1) predictions of the theories that assume this match observations to an extremely precise degree, 2) the symmetry that this uniformity provides is integral to the fundamental nature of how we think about reality (namely, translational symmetry of the laws of physics gives us conservation of energy via Noether's theorem), and 3) there isn't any evidence against it, despite there being a very large number of tests.
As such, this answer will mainly focus on which measurements would be different if there was a substantial change to $G$ under different circumstances.
Is $G$ a function of space and/or time?
If Newtonian gravity worked differently at other locations in our Solar System, then we would have seen it in the orbital trajectories of the objects of known mass that we have sent through the Solar System (like the New Horizons probe, for instance). This doesn't run into any recursive problems because we already know the mass of these objects, since we were the ones who made them.
If gravity worked substantially differently in other star systems within our galaxy, then stellar astrophysics wouldn't work in the same way that it does nearby ("nearby" meaning "within a few hundred light-years"). The life of a star is a constant battle between a few different forces: radiation pressure from nuclear fusion at the core and hydrostatic pressure from the fluid dynamics of the stellar interior push outward, and gravity pulls inward (in older stars, there is also electron degeneracy pressure, but we will consider only youngish, main-sequence stars here). If gravity was stronger, then stars of a given mass would be smaller and more dense; likewise, if gravity was weaker, then stars of a given mass would be bigger and less dense.
The luminosity of a star (the total radiation output) is directly related by the Stefan-Boltzmann law to two quantities: the temperature of the star and its size. We can measure the temperature of a star by observing its color, and we can measure the luminosity of a star by measuring its apparent brightness and distance. Both of these things would change for a star of a given mass. It turns out that we have plotted the luminosity vs. temperature of tens of thousands of stars on the Hertzsprung-Russell diagram, and this plot contains large empty regions. If the luminosity and temperature change in the right way due to this (stellar modeling is complicated, so I don't know precisely how they would change), you might see a bunch of stars from a particular location/time in an otherwise-empty region of the Hertzsprung-Russell diagram, which would indicate that there's something weird going on in that region of space/time. We don't currently see anything like this.
There is still the possibility that the luminosity and temperature would change in just the right way to keep this population of stars within the already-filled regions of the Hertzsprung-Russell diagram. In that case, we have another tool at our disposal: stellar spectra, namely, the width of the spectral lines in different populations of main-sequence stars. It turns out that for stars along the main sequence, we have a pretty good idea what their mass is, given their luminosity, from the appropriately-named mass-luminosity relation. This is important because, given the mass, temperature, and size of a star (where the size is derived from luminosity and temperature), you can determine the average pressure inside the star. A star with higher internal pressure has broader spectral lines - the atoms within it are perturbed more by their neighbors. So if gravity was stronger in a particular region of space/interval of time, we would see a population of stars that would have abnormally high pressures given their luminosity and temperature, and therefore would have abnormally broad spectral lines given their position in the Hertzsprung-Russell diagram. Once again, we have not seen any evidence of this.
If Newtonian gravity was substantially different in other galaxies, then there's a very important, quite visible event that might change: the type Ia supernova, which occurs when the electron degeneracy pressure in a white dwarf is insufficient to combat gravitational collapse. Due to the nature of electron degeneracy pressure, this basically always occurs once a white dwarf reaches a specific mass, called the Chandrasekhar limit. If gravity is stronger, this limit gets smaller, and white dwarfs explode with less energy. Importantly, we can see these supernovae from our galaxy, and we can monitor their apparent brightness with time; in fact, this is one of the ways we can calculate the distance to galaxies. If we can determine the distance by another means, like using redshift measurements, then we could easily see that the Type Ia supernovae from a particular region of space would seem to be abnormally dim, which would mean that the white dwarfs in that region could not get as massive before exploding, which means that the Chandrasekhar limit is different there and $G$ is higher (only making this conclusion after having accounted for other effects, of course). Even if we can't determine the distance by other means, it turns out that the more luminous the Type Ia supernova is, the slower its luminosity declines over time, so we would notice that supernovae from a particular region get dimmer abnormally quickly. Once again, we have not seen any evidence of this as of yet.
Is $G$ a function of the masses?
We have tested the gravitational attraction between two large bodies by examining the orbital motion of the Earth and Moon. We know the mass of the Earth because seismology and geology tell us the density of various parts of it, and we know the volume of those parts. Using the mass of the Earth, we then calibrated scales that we took to the Moon, which means we can also measure the mass of the Moon independent of the orbital motion. We have also tested the gravitational attraction between a large object and a very small one; ultracold neutrons are often kept in open-topped magnetic bowls for experiments, and gravity prevents them from escaping. If we were wrong about the value of $G$ in that experiment, we would notice something odd about the distribution of neutrons in the bowl. We have not yet measured the gravitational interaction between two extremely small objects, but that likely requires a theory of quantum gravity anyway. So, in all cases that we're able to measure, we haven't seen any difference in $G$ as a function of mass.
Is $G$ a function of separation?
Measurements of $G$ have been done at quite close separations, in various iterations of the Cavendish experiment. Measurements have also been done at medium ranges, by again examining the orbital motion of the Earth-Moon system. Measurements have also been done at the interstellar scale, since we are able to discern the luminosity, temperature, spectra, and hence masses of several nearby binary-star systems. None of these measurements seem to be inconsistent with a constant $G$ as a function of separation. At the intergalactic scale, things get a bit muddled due to the presence of dark matter; there are almost surely still a few modified-Newtonian-dynamics theories out there that haven't been completely ruled out by experimental evidence. That said, Newtonian gravity with a constant $G$ and dark matter explains the current experimental evidence very well, especially the evidence in the Bullet Cluster of a direct observation of an invisible lump of mass that produced gravitational lensing, which was the final nail in the coffin for many modified-gravity theories.
In general, these are far from the only tests that have been done; I merely wanted to provide a relatively straightforward example in each case.