This is from Lemma 10.58.9 in Stacks project.
Let $R$ be a Noetherian local ring, $M$ be a finite $R$-module and $N$ a submodule. Suppose $\mathrm{Length}_R(M)=\infty$ and $\mathrm{Length}_R(M/N)<\infty$. Then $\deg(\chi_M(n)-\chi_N(n))$ is less than $\deg(\chi_M(n))$ and $\deg(\chi_N(n))$. (Here $\chi_M(n)=\mathrm{Length}_R(M/\mathfrak{m}^{n+1}M).$)
I was suggested to apply Lemma 10.58.2 which says that we have the following inequality for $n$ large enough $$c_1+\chi_N(n-c_2)\leq\chi_M(n)\leq c_1+\chi_N(n)$$ where $c_1$ and $c_2$ are constants. Now I can see this proves the claim related to $\chi_N(n)$. But I don't know how to use the infinity of $\mathrm{Length}_R(M)$.
Saying that $deg(\chi_M-\chi_N)$ is less than both $deg(\chi_M)$ and $deg(\chi_N)$ is equivalent to saying that $\chi_M$ and $\chi_N$ have the same degree and leading coefficient. The fact that $\chi_M(n)\leq c_1+\chi_N(n)$ for sufficiently large $n$ tells us that $deg(\chi_M)\leq deg(\chi_N)$ and if $deg(\chi_M)=deg(\chi_N)$, then the leading coefficient of $\chi_M$ is at most the leading coefficient of $\chi_N$. Similarly, the fact that $c_1+\chi_N(n-c_2)\leq \chi_M$ for sufficiently large $n$ tells us that $deg(\chi_N)\leq deg(\chi_M)$ and if $deg(\chi_N)=deg(\chi_M)$, then the leading coefficient of $\chi_N$ is at most the leading coefficient of $\chi_M$.
My argument tacitly used the assumption that $\chi_M$ and $\chi_N$ have degree at least $1$, so I will justify in full detail why this must be the case. Assume that $deg(\chi_M)<1$. Then $\chi_M$ is eventually constant, so there exists $c$ such that $\chi_M(n)=c$ for sufficiently large $n$. Consider now the sequence of submodules
$$0=\mathfrak{m}^{c+1}M/\mathfrak{m}^{c+1}M\subseteq\mathfrak{m}^{c}M/\mathfrak{m}^{c+1}M\subseteq\cdots\subseteq\mathfrak{m}M/\mathfrak{m}^{c+1}M\subseteq M/\mathfrak{m}^{c+1}M$$
in $M/\mathfrak{m}^{c+1}M$. There are $c+2$ submodules in this sequence, so it has length $c+1$. But $length(M/\mathfrak{m}^{c+1}M)\leq c$ (since $\chi_M(n)$ is a nondecreasing sequence) which implies
$$\mathfrak{m}^jM/\mathfrak{m}^{c+1}M=\mathfrak{m}^{j+1}M/\mathfrak{m}^{c+1}M$$
for some $j\in\{0,1,\ldots,c\}$ and therefore $\mathfrak{m}^jM\subseteq\mathfrak{m}^{j+1}M+\mathfrak{m}^{c+1}M=\mathfrak{m}^{j+1}M$. However, $\mathfrak{m}^{j}M=\mathfrak{m}^{j+1}M$ implies that $\mathfrak{m}^{j}M=\mathfrak{m}^{n}M$ for all $n\geq j$ by induction, so then
$$\cap_{i=1}^\infty\mathfrak{m}^{i}M=\mathfrak{m}^{j}M.$$
But by the Krull intersection theorem, $\cap_{i=1}^\infty\mathfrak{m}^{i}M=0$ and therefore $m^jM=0$. Finally, this implies that $length(M)<\infty$ (see Lemma 10.51.8). This contradicts our hypothesis, so we must have $deg(\chi_M)\geq 1$. Since $\chi_M$ has degree at least $1$, it is clear that $\chi_N$ does as well.