Note that $2023 = 7 \cdot 17^2$
$p=3$
\begin{align}
n^2-n-2023 \equiv 0 \pmod 3 \\
n^2+2n-1 \equiv 0 \pmod 3 \\
(n+1)^2 \equiv 2 \pmod 3
\end{align}
\begin{array}{|c|cc|}
\hline
n \mod 3 & 0 & 1,2 \\
n^2 \mod 3 & 0 & 1 \\
\hline
\end{array}
The perfect squares modulo $3$ are $0$ and $1$. So there is no solution.
$p=5$
\begin{align}
n^2-n-2023 &\equiv 0 \pmod 5 \\
n^2+4n+2 &\equiv 0 \pmod 5 \\
(n+2)^2+3 &\equiv 0 \pmod 5 \\
(n+2)^2 &\equiv 2 \pmod 5
\end{align}
\begin{array}{|c|ccc|}
\hline
n \mod 5 & 0 & 1,4 & 2,3 \\
n^2 \mod 5 & 0 & 1 & 4 \\
\hline
\end{array}
The perfect squares modulo $5$ are $0, 1, 4$. So there is no solution.
$p=7$
\begin{align}
n^2-n-2023 &\equiv 0 \pmod 7 \\
n^2-n &\equiv 0 \pmod 7 \\
n(n-1) &\equiv 0 \pmod 7 \\
\end{align}
Clearly $n \equiv 0 \pmod 7$ and $n \equiv 1 \pmod 7$ are solutions.