If $2n+1=a^2$ and $3n+1=b^2$, then $a$ is odd. So $a=2k+1$ and $2n+1=(2k+1)^2=4k^2+4k+1$. Thus, $n=2k^2+2k=2k(k+1)$. This shows that $n$ is divisible by $4$ because $k(k+1)$ is even.
Now, $b^2=3n+1=6k(k+1)+1$. So, $b$ is also odd and $b=2l+1$. Then, $(2l+1)^2=6k(k+1)+1$ implies $2l(l+1)=3k(k+1)$. That is $k(k+1)$ is divisible by $4$ because $l(l+1)$ is even. Because $n=2k(k+1)$ and $k(k+1)$ is divisible by $4$, $n$ is divisible by $8$.
In fact, $3a^2-2b^2=3(2n+1)-2(3n+1)=1$. That is,
$$(1+\sqrt{-2})(1-\sqrt{-2})a^2=1+2b^2=(1+\sqrt{-2}b)(1-\sqrt{-2}b).$$
Note that $\Bbb{Q}(\sqrt{-2})$ is a quadratic field with class number $1$, it is a ufd and we can talk about gcd. Because $\gcd(1+\sqrt{-2}b,1-\sqrt{-2}b)=1$, we get that either
$$\frac{1+\sqrt{-2}b}{1+\sqrt{-2}}=(u+\sqrt{-2}v)^2$$
or $$\frac{1-\sqrt{-2}b}{1+\sqrt{-2}}=(u+\sqrt{-2}v)^2$$
for some $u,v\in\Bbb{Z}$. But up to sign switching $b\to -b$, we can assume that
$$\frac{1+\sqrt{-2}b}{1+\sqrt{-2}}=(u+\sqrt{-2}v)^2=u^2-2v^2+2uv\sqrt{-2}.$$
That is,
$$1+\sqrt{-2}b=u^2-2v^2-4uv+(u^2-2v^2+2uv)\sqrt{-2}.$$
So, $u^2-2v^2-4uv=1$ and so $(u-2v)^2-6v^2=1$. So, $(x,y)=(u-2v,v)$ is a solution to the Pell-type equation
$$x^2-6y^2=1.$$
The solutions are known $$x+\sqrt{6}y=\pm(5+2\sqrt{6})^t$$
where $t\in\Bbb{Z}$. Since the sign switching $(u,v)\to(-u,-v)$ does not change anything, we can assume that $$u-2v+\sqrt{6}v=(5+2\sqrt{6})^t.$$
So, $$u-2v=\frac{(5+2\sqrt{6})^t+(5-2\sqrt{6})^{t}}{2}$$
and $$v=\frac{(5+2\sqrt{6})^t-(5-2\sqrt{6})^{t}}{2\sqrt{6}}.$$
That is,
$$u=\frac{(2+\sqrt{6})(5+2\sqrt{6})^t-(2-\sqrt{6})(5-2\sqrt{6})^{t}}{2\sqrt{6}}.$$
That is,
$$b=u^2-2v^2+2uv=\frac{(2+\sqrt{6})(5+2\sqrt{6})^{2t}+(2-\sqrt{6})(5-2\sqrt{6})^{2t}}{4}.$$
This gives
$$a=\sqrt{\frac{1+2b^2}{3}}=u^2+2v^2=\frac{(3+\sqrt{6})(5+2\sqrt{6})^{2t}+(3-\sqrt{6})(5-2\sqrt{6})^{2t}}{6}.$$
So, we have
$$n=\frac{(5+2\sqrt{6})^{4t+1}-10+(5-2\sqrt{6})^{4t+1}}{24},$$
where $t\in\mathbb{Z}$. So the first seven values of $n$ are
$$n=0,40,3960, 388080,38027920,3726348120,365144087880.$$
That is, $n=n(t)$ satisfies $n(0)=0$ and $n(-1)=40$ with
$$n(t-1)+n(t+1)=9602 n(t)+4000$$
for all $t\in\mathbb{Z}$. So, not only $8$ divides $n$, $40$ divides $n$ for every such $n$.
I think it is easier to re-parametrize $n$ using non-negative integers instead of all integers. Let $$n_t=\frac{(5+2\sqrt{6})^{2t+1}-10+(5-2\sqrt{6})^{2t+1}}{24},$$
for non-negative integer $t$. So, $n_0=0$, $n_1=40$, and $$n_{t+2}=98n_{t+1}-n_t+40.$$
We have the corresponding $a=a_t$ and $b=b_t$ to $n=n_t$: $a_0=1$, $a_1=9$, and
$$a_{t+2}=10a_{t+1}-a_t,$$
as well as $b_0=1$, $b_1=11$, and
$$b_{t+2}=10b_{t+1}-b_t.$$
$$
\begin{array}{ |c|c|c|c| }
\hline
t & n_t & a_t & b_t \\ \hline
0 & 0 & 1 &1 \\
1 & 40 & 9& 11 \\
2 & 3960 & 89 & 109 \\
3 & 388080 & 881 &1079\\
4 & 38027920 & 8721 & 10681 \\
5 & 3726348120 & 86329 & 105731 \\
6 & 365144087880 & 854569 & 1046629
\\\hline
\end{array}
$$
In modulo arithmetic, "division" means multiplying by the multiplicative inverse, e.g., $b = \frac{1}{a}$ means the value which when multiplied by $a$ gives $1$ modulo the value, e.g., $ba \equiv 1 \pmod n$. Note you may sometimes see $b = a^{-1}$ instead to avoid using explicit "division". This works, and gives a unique value, in any cases where the value you're dividing and the modulus are relatively prime.
More generally, it'll work in all cases of $\frac{c}{a} \equiv e \pmod n$ where $d = \gcd(a,n)$ and $d \mid c$ since this gcd value "cancels" in the division. Thus, the resulting equivalent modulo equation of $\frac{c'}{a'} \equiv e \pmod n$, where $c' = \frac{c}{d}$ and $a' = \frac{a}{d}$ has $\gcd(a',n) = 1$, has a solution. However, as Bill Dubuque's comment indicates, this assumes you're doing integer division to the extent of removing the common factor of $d$. Note that $a^{-1}$ doesn't exist modulo $n$ in this case. However, $(a')^{-1}$ does exist modulo $\frac{n}{d}$, so a possible interpretation would be $\frac{c'}{a'} \equiv c'(a')^{-1} \equiv e \pmod{\frac{n}{d}}$.
As for why the multiplicative inverse $b = a^{-1}$ exists modulo $n$ if $\gcd(a,n) = 1$, Bézout's identity states that in such cases there exist integers $x$ and $y$ such that
$$ax + ny = 1 \tag{1}\label{eq1}$$
As such $ax \equiv 1 \pmod n$ so $x \equiv a^{-1} = b \pmod n$. This value must be unique, modulo $n$, because if there was another value $x'$ such that $xa \equiv x'a \equiv 1 \pmod n$, then $(x - x')a \equiv 0 \pmod n$. Since $\gcd(a,n) = 1$, this means that $x - x' \equiv 0 \pmod n \; \iff \; x \equiv x' \pmod n$.
Bézout's identity also shows that if $a$ and $n$ are not relatively prime, e.g., $\gcd(a,n) = d \gt 1$, then \eqref{eq1} becomes
$$ax + ny = d \tag{2}\label{eq2}$$
with the integers of the form $ax + ny$ are always multiples of $d$, so it can't be congruent to $1$ and, thus, $a$ would not have a multiplicative inverse.
Best Answer
Let $a,b \in N$ be such that $a^2+3b^2 = 25n$. Note that $a^2+3b^2 \equiv 0 \pmod{5}$. Since, for any $x$, we have $x^2 \equiv 0, \pm 1 \pmod{5}$, it follows using a case-by-case analysis that $a^2+3b^2 \equiv 0 \pmod{5}$ implies that $a,b \equiv 0 \pmod{5}$.
So $a,b$ are multiples of $5$, and hence $a^2,b^2$ are multiples of $25$. Dividing the previous equation by $25$ we have $\left(\frac{a}{5}\right)^2 + 3\left(\frac{b}{5}\right)^2 = n$.
Next, we note that \begin{align} (a^2+3b^2)(c^2+3d^2) &= a^2c^2+3b^2c^2+3a^2d^2+9b^2d^2 \\ &= (a^2c^2+6abcd+9b^2d^2) + 3(b^2c^2-2abcd+a^2d^2) \\ &= (ac+3bd)^2 + 3(bc-ad)^2. \end{align}
Therefore, to prove that $2023n$ is of the form $x^2+3y^2$ it is sufficient to prove that $2023$ is of that form. However, note that $2023$ can be factorised as $2023 = 289 \times 7$, and $7 = 2^2+3 \times 1^2$. Therefore, $2023 = 34^2 + 3 \times 17^2$, completing the proof.