This is the Proposition 2.11 of the book Real Analysis from Folland.
The following implications are valid if and only if the measure is complete:
(a) If $f$ is measurable and $f = g$ $\mu$-a.e., then $g$ is measurable.
(b) If $f_n$ is measurable for $n\in \mathbb{N}$ and $f_n\rightarrow f$ $\mu$-a.e., then $f$ is measurable.
The complete solution to this question can be found in this answer. But note that it was considered that $f,g:(X,\mathcal{M})\to(\mathbb{R},\mathcal{B}_{\mathbb{R}})$, other solutions like [1] or others that I found on the internet also assume that the image is $\mathbb{R}$ or $\overline{\mathbb{R}}$.
I'm thinking about the general case, where, $f:(X,\mathcal{M})\to(Y,\mathcal{N})$. In this answer, the proposition $\mu$ is complete $\Rightarrow$ (a) is demonstrated in the general case.
I tried to show the opposite direction but I couldn't, in the general case is this proposition true? How to demonstrate this?