The inverse square law says that the intensity of incident light falls off in proportion to the inverse of the square of the distance from the light source.
The important word here is "the distance" — the inverse square law implicitly assumes that all parts of the light source are at the same distance from the measurement point, or at least approximately so. For real-world light sources, which are not infinitesimally small points, this approximation must necessarily fail when you get close enough to the source — you can pick a measurement point arbitrarily close to some part of the source, but you can't get it arbitrarily close to all parts of the source at the same time.
So, how close is too close, then? For that, we can come up with all kinds of rules of thumb (like, say, "no closer than $x$ times the maximum diameter of the source", for some value $x$), but if you want a precise, quantitative answer, we're going to have to do some math.
For simplicity, let's consider the (in some sense worst) case where the extended light source consists of two identical, very small pointlike light sources spaced a distance $2d$ apart. (We assume that the diameter of the individual point sources is very small compared to the distance $d$, so that it can be safely neglected.) We'll take the midpoint between the two point sources (i.e. at distance $d$ from each of them) as the nominal center of the extended light source, and place our measuring device at a distance $r > d$ from it.
Let's first look at the case where the two point sources and the measuring device are all collinear (or just very slightly staggered, so that the two point sources won't eclipse each other). Then one of the point sources will actually be at the distance $r_1 = r - d$ and the other one at the distance $r_2 = r + d$ from the measurement point. Thus (since each individual point source is assumed to be negligibly small, and so follows the inverse square law very closely) the combined intensity of the light from the two sources will be proportional to:
$$\frac12 \left( \frac1{r_1^2} + \frac1{r_2^2} \right)
= \frac12 \left( \frac1{(r - d)^2} + \frac1{(r + d)^2} \right)
= \frac1{r^2 - d^2}
\\\approx \frac1{r^2} \left(1 + \left(\tfrac{d}{r}\right)^2 + \left(\tfrac{d}{r}\right)^4 + \dots \right)
$$
where the dots denote higher-order terms ($O(\frac{d^6}{r^6})$ and higher).
We can also look at the opposite case, where the line between the point sources is perpendicular to the line from its midpoint to the measurement point, so that by Pythagoras' law, $r_1 = r_2 = \sqrt{r^2 + d^2}$. Then the actual light intensity at distance $r$ from the midpoint is:
$$\frac12 \left( \frac1{r_1^2} + \frac1{r_2^2} \right)
= \frac1{r^2 + d^2}
\approx \frac1{r^2} \left(1 - \left(\tfrac{d}{r}\right)^2 + \left(\tfrac{d}{r}\right)^4 - \dots \right).
$$
In both cases, the relative error in the $\frac1{r^2}$ approximation is approximately proportional to the square of $\frac dr$ (and the absolute error is thus inversely proportional to the fourth power of $r$), although the sign of the leading error term is different.
Other configurations of point sources (with the same maximum diameter $2d$) will generally fall somewhere in between these two extreme cases. Thus, when the distance $r$ to the light source is, say, 10 times the half-diameter $d$ of the source, we can pretty confidently say that the relative error in the light intensity calculated using the simple inverse square approximation, compared to the true intensity obtained by integrating over the full extended light source, is at most $\left(\frac{1}{10}\right)^2 = \frac{1}{100} = 1\%$.