I had a lot of help on this question in chat from users Srivatsan and t.b. the other day. I tried my best to write up what was said as an answer here.
Notice that the sets $\overline{f(V_n(p))}\supseteq\overline{f(V_{n+1}(p))}\supseteq\cdots$ form a nested sequence of closed sets. Moreover, let $\epsilon>0$ be given. Since $f$ is uniformly continuous, there exists $\delta>0$ such that $d(p,q) < \delta$ implies $d(f(p),f(q))<\epsilon$ for $p,q\in E$. Taking $n$ large enough so that $\frac{2}{n}<\delta$, then for $q,r\in V_n(p)$,
$$
d(q,r)<d(q,p)+d(p,r)<\frac{2}{n}<\delta
$$
so $d(f(q),f(r))<\epsilon$. Thus $f(V_n(p))$ is bounded in $\mathbb{R}$, so $\overline{f(V_n(p))}$ is bounded as well. Hence for large enough $n$ the sets form a compact nested sequence. Since $V_n(p)$ has diameter at most $\frac{2}{n}$, taking $n>2/\delta$ would imply
$$
\operatorname{diam } f(V_n(p))=\operatorname{diam }\overline{f(V_n(p))}<\epsilon
$$
So $\lim_{n\to\infty}\operatorname{diam }\overline{f(V_n(p))}=0$, and thus their intersection consists of a single point. Also, since $\operatorname{diam }f(V_n(p))\to 0$ as $n\to\infty$, and so by choosing points arbitrarily close to $p$, their images under $g$ are arbitrarily close to $g(p)$. (To be more explicit, letting $\delta$ be small enough such that for $x,y\in E$, then $d(x,y)<2\delta$ implies $d(f(x),f(y))<\epsilon/3$, choose $n$ large enough that $\frac{1}{n}<\delta$, and thus for any $x,y\in V_n(p)$, $d(x,y)<2/n<2\delta$, so $\operatorname{diam }f(V_n(p))<2\epsilon/3$, so $d(f(x),g(p))<2\epsilon/3$. Note also that this can be done for any $p$.)
I contend that $g$ is uniformly continuous. Let $\epsilon>0$ be given. Since $f$ is uniformly continuous, there exists $\delta>0$ such that $d(r,s)<\delta$ implies $d(f(r),f(s))<\epsilon/3$. Now let $p,q\in X$ be any points such that $d(p,q)<\delta/3$. By the above reasoning, choose $n$ large enough so that $n>\frac{3}{\delta}$, and both $d(g(r),g(p))<\epsilon/3$ and $d(g(s),g(q))<\epsilon/3$ for $r\in V_n(p)$ and $s\in V_n(q)$. Also,
$$
d(r,s)<d(r,p)+d(p,q)+d(q,s)<\delta
$$
so $d(f(r),f(s))=d(g(r),g(s))<\epsilon/3$. By the triangle inequality, $d(g(p),g(q))<\epsilon$, so $g$ is uniformly continuous, and thus continuous on $X$, and of course $g|_E=f$.
You are correct. To make it precise, first assume that $f$ is not uniformly continuous, then there is a fixed $\epsilon >0$ and $p_n, q_n$ such that
$$d(p_n, q_n) \leq 1/n \ \text{ and }d(f(p_n)), f(q_n) ) > \epsilon$$
By passing to subsequence if necessary, we can assume that $p_n \to x$ as $X$ is compact. As $d(p_n, q_n) \to 0$, we also have $q_n \to x$. By continuity of $f$,
$$\lim_{n\to \infty} f(p_n) = f(x) = \lim_{n\to \infty} f(p_n) .$$
But this is a impossible as $d(f(p_n), f(q_n)) > \epsilon$. Thus no such two sequences could be found and $f$ is uniformly continuous.
Best Answer
Uniform continuity ensures that the Cauchy sequence $(q_n)$ in $\mathbb Q$ is mapped to a Cauchy (and hence convergent) sequence $\bigl(f(q_n)\bigr)$ in $\mathbb R$. If $f$ is just continuous, $\bigl(f(q_n)\bigr)$ needn't converge (remember: $f$ is just continuous on $\mathbb Q$, so you can't argue, that convergent sequences $q_n \to r \not\in\mathbb Q$ are mapped onto convergent sequences by $f$). For example $x\mapsto \frac 1{x - \sqrt 2}$ is continuous (not uniformly!) on $\mathbb Q$ and can't be extendend.
In fact, you only need the property, that Cauchy sequences are mapped to Cauchy sequences, which is a little weaker than uniform continuity, and a little stronger than continuity (for some properties of such functions, see here for start).