This gcd is computable mechanically by a slight generalization of the Euclidean algorithm which allows us to scale by integers $\,\color{#c00}c\,$ coprime to the gcd in a GMR = GCD Modular Reduction step i.e.
$$\bbox[8px,border:2px solid #c00]{(a,b)\, = \,(a,\,\color{#c00}c\:\!b)\ \ \ {\rm if}\ \ \ (a,c) = 1}\quad\ {\rm GMR}'\ \, $$
$$\begin{align}
{\rm thus}\ \ \ (2n\!-\!3,\, 3n^2\!+\!1) &= (2n\!-\!3,\, \color{#c00}4(3n^2\:\!+\,1))\ \ {\rm by}\ \ \color{#c00}{c=4}\ \ \rm above\\[.2em]
&= (\color{#0a0}{2n\!-\!3},\, 3(\color{#0a0}{2n})^2\!+4)\\[.2em]
&= (2n\!-\!3,\, 3\,(\,\color{#0a0}3\,)^2\!+4)\ \ \rm{divides}\,\ 31 = 3(\color{#0a0}3)^2\!+4
\end{align}\qquad\quad $$
where the final equality uses $\,(a,b) = (a,b')\ $ if $\color{#0a0}{\bmod a\!:\ b\equiv b'},\,$ i.e. $\rm GMR,\,$ which here is
$\bmod\, \color{#0a0}{2n\!-\!3}\!:\,\ \color{#0a0}{2n\equiv 3}\Rightarrow f(\color{#0a0}{2n})\equiv f(\color{#0a0}3)$ for any polynomial $f(x)$ with integer coefficients, by PCR= Polynomial Congruence Rule (= composition of Sum & Product rules).
So the gcd $ = (31,2n\!-\!3)>1\!\iff\!$ $31\mid 2n\!-\!3\iff n\equiv 17\pmod{\!34}\,$ by
$\!\bmod 31\!:\ 2n\!-\!3\equiv 0\iff n\equiv \dfrac{3}2\equiv \dfrac{34}2\equiv 17\,$ via a twiddle (see here or here)
Remark $ $ Generally, if $\,(a,b)\!=\!1\,$ then $\,{\rm GMR}\Rightarrow (a,an\!+\!b)\!=\!1\,$ so $\,(\color{#c00}{a^k},an\!+\!b)\!=\!1\,$ by Euclid's Lemma, so, as above, if $\,p(x)\,$ is a polynomial of degree $\,k\,$ with integer coefficients then $$\qquad\begin{align} \bmod\!\!\!\! &\ \ \ an+b\!:\,\ p(n)\,\equiv\, p(-b/a),\,\ {\rm by}\,\ n\equiv -b/a\,\ \&\,\ \rm PCR\\[.5em]
\overset{\small\rm GMR'}\Longrightarrow\,\ &\bbox[8px,border:2px solid #c00]{(an+b,\,p(n)) \,=\, (an+b,\,\color{#c00}{a^k}p(-b/a))}\end{align}\qquad$$ We can compute $\,a^kp(-b/a)\,$ in the gcd by a fraction-free method via scaling - as we did above.