6. If the solution set of the inequality $x^{2}<|x-1|+a$ is a subset of the interval $(-3,3)$, then the range of the real number $a$ is ( ).
(A) $(-\infty, 7)$
(B) $(-\infty, 7]$
(C) $(-\infty, 5)$
(D) $(-\infty, 5]$
6. D.

When $x \geqslant 1$, the original inequality becomes
$$
x^{2}-x+1-a<0 \text {, }
$$

its solution set does not contain any number greater than or equal to 3.
Therefore, when $x \geqslant 3$, we always have
$$
x^{2}-x+1-a \geqslant 0 \text {, }
$$

which leads to $a \leqslant 7$.
When $x<1$, the original inequality becomes
$$
x^{2}+x-1-a<0 \text {, }
$$

its solution set does not contain any number less than or equal to -3.
Therefore, when $x \leqslant-3$, we always have
$$
x^{2}+x-1-a \geqslant 0 \text {, }
$$

which leads to $a \leqslant 5$.
In summary, $a \in(-\infty, 5]$.