The standard construction of $\newcommand{\PP}{\mathbb{P}} \DeclareMathOperator{\Hilb}{Hilb} \DeclareMathOperator{\PGL}{PGL} M_g$ is as follows (At least for stable curves and other technical conditions).
Naive attempt; On all curves of genus $g$, take $w^N$ for some fixed $N$ making the line bundle ample. Then this gives an embedding of all genus $g$ curves into $\PP^k$ (for $k$ the rank of the linear system). Now take the hilbert subscheme of the hilbert polynomial (which is the same for all those curves) $p$; I.e., $H=\Hilb(\PP^k, p)$. Note that $\PGL_k$ acts on it, and simply divide by the action to obtain $M_g$!
This doesn't work because there are representatives of the curve $C$ in $H=\Hilb(\PP^k, p)$ not connected via $\PGL_n$ (namely any ample line bundle of the same degree gives such an embedding). What I saw in some place is that given a curve $C$ we consider its $\PGL$ orbit in $H$, and take a small nbr of transveral subspace (giving what's called a Kurwishi family, i.e a universal deformation space of the curve). Then he claims gluing all those families gives $M_g$.
Why does this strategy not run into the same problem? Can we show that near the $\PGL$ orbit of $C$ in $H$ there aren't any other copies of $C$?
The answer is that one is able to algebraically specify which curves are embedded via the canonical bundle (tensored 3 times).
Indeed, we have two natural line bundles on the universal curve given via the hilbert scheme.
One is the pullback of $\mathcal{O}(1)$ from $\mathbb{P}^n$ denoted $M$, and the other denoted $L$ is fiberwise the canonical line bundle.
So both $L, M$ are line bundles on the universal curve and we want to see where they agree. We can consider the line bundle $\mathfrak{H}om(L,M)$, so we're asking over which fibers it has a section. This is expressible as an algebraic subset (or complement or whatever).