Step 1: Equation of the line.
The given equation of the line is:
\[
\mathbf{r} = (3 + \lambda)\hat{i} + (-2 + \lambda)\hat{j} + (1 + \lambda)\hat{k}
\]
The direction ratios of the line are the coefficients of \( \hat{i}, \hat{j}, \hat{k} \), which are:
\[
\mathbf{d} = \langle 1, 1, 1 \rangle
\]
Step 2: Equation of the plane.
The given equation of the plane is:
\[
\mathbf{r} \cdot \langle 2, 1, 1 \rangle = 4
\]
This represents a plane with the normal vector:
\[
\mathbf{n} = \langle 2, 1, 1 \rangle
\]
Step 3: Use the distance formula between a point and a plane.
The distance \( D \) between a point \( P_1(x_1, y_1, z_1) \) and a plane \( ax + by + cz + d = 0 \) is given by:
\[
D = \frac{|ax_1 + by_1 + cz_1 + d|}{\sqrt{a^2 + b^2 + c^2}}
\]
In this case, the point on the line is \( (3 + \lambda, -2 + \lambda, 1 + \lambda) \), and the plane equation is \( 2x + y + z - 4 = 0 \).
Step 4: Substitute the values into the formula.
Substituting the coordinates of the point and the normal vector of the plane into the formula, we get:
\[
D = \frac{|2(3 + \lambda) + 1(-2 + \lambda) + 1(1 + \lambda) - 4|}{\sqrt{2^2 + 1^2 + 1^2}} = \frac{|6 + 2\lambda - 2 + \lambda + 1 + \lambda - 4|}{\sqrt{6}}
\]
Simplifying the numerator:
\[
D = \frac{|1 + 4\lambda|}{\sqrt{6}}
\]
Step 5: Set the distance equal to 4 (as the given value).
The distance is given as 4 units. So:
\[
\frac{|1 + 4\lambda|}{\sqrt{6}} = 4
\]
Multiplying both sides by \( \sqrt{6} \), we get:
\[
|1 + 4\lambda| = 4\sqrt{6}
\]
Now solving for \( \lambda \):
\[
1 + 4\lambda = 4\sqrt{6} \quad \text{or} \quad 1 + 4\lambda = -4\sqrt{6}
\]
Solving both cases:
\[
\lambda = \frac{4\sqrt{6} - 1}{4} \quad \text{or} \quad \lambda = \frac{-4\sqrt{6} - 1}{4}
\]
Step 6: Final answer.
After simplifying, we can conclude that the distance between the line and the plane is:
\[
\boxed{\frac{1}{\sqrt{6}}}
\]