Reformulation of the problem
Euclidean spaces are the adequate setting to discuss elementary geometry. In this case we are considering a two-dimensional euclidean space, i.e. an affine space $E$ with a two-dimensional real translation space $V$ and an inner product on $V$. We assume we are given an orthonormal basis $e$ of $V$, $$V\ni v\mapsto v_e\in\mathbb R^2$$is the induced isomorphism and $O,A,M,N\in E$. We are given that $$\overrightarrow{OA}_e=\begin{pmatrix}2\\1\end{pmatrix}$$and$$\overrightarrow{ON}_e=\begin{pmatrix}3\\4\end{pmatrix}$$
In addition, $\overrightarrow{ON}=\overrightarrow{OM}+\overrightarrow{MN}$ is the decomposition of $\overrightarrow{ON}$ as the sum of a vector parallel to $\overrightarrow{OA}$ and a vector perpendicular to $\overrightarrow{OA}$. All we need to do to solve your problem is to determine the vector $\overrightarrow{OM}$: If we know $\overrightarrow{OM}$, then the distance from $M$ to $N$ is given by
$$\|\overrightarrow{MN}\|=\|\overrightarrow{ON}-\overrightarrow{OM}\|$$
and the distance from $A$ to $M$ is given by
$$\|\overrightarrow{AM}\|=\|\overrightarrow{OM}-\overrightarrow{OA}\|$$
So now our problem consists in determining $\overrightarrow{OM}$.
Solution of the reformulated problem
Suppose $u,v\in V$, $u\neq 0$ and we want to determine the decomposition $v=v_\parallel+v_\perp$ where $v_\parallel$ is parallel to $u$ and $v_\perp$ is perpendicular to $u$. It is well known that $$v_\parallel=\frac{u\cdot v}{u\cdot u}u$$
and this is not difficult to proof, but let me give an intuitive explanation:
Using $\|u\|=\sqrt{u\cdot u}$ and $u\cdot v=\|u\|\|v\|\cos\theta$ we obtain
$$v_\parallel=\frac{u\cdot v}{\|u\|}\frac{u}{\|u\|}=\|v\|\cos\theta\frac{u}{\|u\|}$$
i.e. $v_\parallel$ is the vector with the length $\|v\|\cos\theta$ pointing in the same direction as $u$ (if $\cos\theta>0$).
If we apply this to our problem, we obtain $$\overrightarrow{OM}=\frac{\overrightarrow{OA}\cdot\overrightarrow{ON}}{\overrightarrow{OA}\cdot\overrightarrow{OA}}\overrightarrow{OA}$$In addition, since $e$ is orthonormal, we have that $v\cdot w=v_e\cdot w_e$ for all $v,w\in V$. So now all you need to do is plug in the numbers and you'll see that the answer to your question is YES.