$X$ topological space and $D$ dense in $X$. If $Y$ is $T_2$ and $f,g$ continuous s.t $f(d)=g(d)$ for all $d\in D$ then $f(x)=g(x)$ for all $x\in X$ This is my attempt of proving this:
Let $f(x),g(x)\in Y$. Because $Y$ is Hausdorff we can find open disjoint subsets of $Y$, namely $U,V$ of $f(x)$ and $g(x)$ respectively such that $f(x)\in U$ and $g(x)\in V$. Applying the continuity of $f$ and $g$ we have that $f^{-1}(U)$ and $g^{-1}(V)$ are open sets of $X$ both containing $x$.
Because $D$ is dense in $X$, $x\in \bar{D}$, this means that for all open subsets $U$ of $X$ we have $U\cap D\neq\emptyset$. Of course, this works for the open sets $f^{-1}(U)$ and $g^{-1}(V)$. Then we have that $f^{-1}(U)\cap D\neq\emptyset$ and $g^{-1}(V)\cap D\neq\emptyset$.
We take $z\in f^{-1}(U)\cap D$ and $z'\in g^{-1}(V)\cap D $. This means that $f(z)\in U\cap f(D)$ and $g(z')\in V\cap g(D)$. But because $z,z' \in D$, by our hypothesis $f(z)=g(z)$ and $f(z')=g(z')$. Because $f(x),g(x)$ were arbitrary, $f(x)=g(x)$ for all $x\in X$
 A: You go a bit astray right at the start: unless you explicitly assume that $f(x)\ne g(x)$, which you did not do, you cannot say that $f(x)$ and $g(x)$ have disjoint open nbhds. For the approach that you’re taking, you should begin something like this:

Suppose that there is an $x\in X$ such that $f(x)\ne g(x)$.

Then you can argue that $f(x)$ and $g(x)$ have disjoint open nbhds $U$ and $V$, respectively, and that $f^{-1}[U]$ and $g^{-1}[V]$ are open nbhds of $x$. It’s true that there are $z\in D\cap f^{-1}[U]$ and $z'\in D\cap g^{-1}[V]$, but nothing in the hypotheses lets you conclude that $f(z)=g(z')$. The hypothesis says only that $f(z)=g(z)$ for each $z\in D$; it says nothing about the values of $f$ and $g$ at two different points of $D$. You need a single point $z$ that is in both $D\cap f^{-1}[U]$ and $D\cap g^{-1}[V]$.
Fortunately, this is not a problem: $f^{-1}[U]$ and $g^{-1}[V]$ are open nbhds of $x$, so their intersection is also an open nbhd of $x$ and therefore contains a point of $D$. That is, there is a $z\in D\cap f^{-1}[U]\cap g^{-1}[V]$, and now you can conclude the argument along the lines that you had in mind: $f(z)\in U$, $g(z)\in V$, and $U\cap V=\varnothing$, so $f(z)\ne g(z)$, contradicting the hypothesis that $f$ and $g$ agree on $D$. This contradiction shows that no such point $x$ exists and hence that $f(x)=g(x)$ for all $x\in X$.
