There is no minimum or maximum distance from a foundation, footing, panel or otherwise.
It is best to keep it as close as possible, but nothing dictates this by code.
The main thing you want to avoid is getting it a few feed down then hitting the footing. This is a PIA.
Here are the relevant code sections with regard to spacing.
Taken form the 2001 NEC.
III. Grounding Electrode System and Grounding Electrode Conductor
250.50 Grounding Electrode System
All grounding electrodes as described in 250.52(A)(1) through (A)(7)
that are present at each building or structure served shall be bonded
together to form the grounding electrode system. Where none of these
grounding electrodes exist, one or more of the grounding electrodes
specified in 250.52(A)(4) through (A)(8) shall be installed and used.
250.53 Grounding Electrode System Installation
(B) Electrode Spacing.
Where more than one of the electrodes of the type specified in
250.52(A)(5) or (A)(7) are used, each electrode of one grounding system (including that used for strike termination devices) shall not
be less than 1.83 m (6 ft) from any other electrode of another
grounding system. Two or more grounding electrodes that are bonded
together shall be considered a single grounding electrode system.
(G) Rod and Pipe Electrodes.
The electrode shall be installed such that at least 2.44 m (8 ft) of
length is in contact with the soil. It shall be driven to a depth of
not less than 2.44 m (8 ft) except that, where rock bottom is
encountered, the electrode shall be driven at an oblique angle not to
exceed 45 degrees from the vertical or, where rock bottom is
encountered at an angle up to 45 degrees, the electrode shall be
permitted to be buried in a trench that is at least 750 mm (30 in.)
deep. The upper end of the electrode shall be flush with or below
ground level unless the aboveground end and the grounding electrode
conductor attachment are protected against physical damage as
specified in 250.10.