Precisely because the inverse square law is so common, is also interesting to consider the cases where it does not apply. In essence, it holds whenever something is spread evenly around a point source. It fails:

1. When the source cannot be approximated with a point. For example, when an observer looking at an infinitely long straight glowing wire takes a step back, the light from a given part of the wire seems less intense, but at the same time more of the wire comes into view. The intensity in that case turns out to be inversely proportional to distance, i.e. I ~ r-1. The glowing filament in a light bulb is shorter than infinity, but longer than a point, so if you experimentally plot the intensity against distance you get an exponent between -2 and -1, perhaps I ~ r-1.9.

Similarly, inside a hollow glowing ball, the light intensity from a given direction will be independent of the distance. In the case of forces, this means that there is no gravity inside a massive hollow sphere, and no electric force inside a charged shell.

2. When the spreading is not uniform. For example, sound vibrations in a railway track are confined to the inside of the rail. They are thus kept together, and will not decrease in intensity at all. Eventually the sound will fall off for other reasons, but it is still audible over very long distances. This is why the Indians in western movies hold their ear to the track of the train they are about to ambush.

A more esoteric example is the strong nuclear force that acts between quarks. Due to strange properties of space (lots of gluons swishing around in a less-than-zero energy state), this force is squished together like a railway track. This means that the force between a pair of quarks is independent of the distance between them, which in turn means that it is impossible to separate them completely (which would require infinite energy) - there can be no free quarks.