Given two topological spaces $X_1, X_2$, I am looking for a characterisation of homeomorphism that works something like this:
$$ X_1 \simeq X_2 \iff \forall Y \text{ topological space } \mathcal{C}(X_1,Y) \simeq \mathcal{C}(X_2,Y) $$
where the first $\simeq$ is of course a homeomorphism, while the second $\simeq$ is some sort of isomophism yet to be (if possible) defined.
I was wondering if this statement could be also taken:
$$ X_1 \simeq X_2 \iff \mathcal{C}(X_1,X_2) \simeq \mathcal{C}(X_2,X_1) $$
Your intuition is spot on: this is Yoneda's lemma. If $\mathsf{C}$ is some (locally small) category, the lemma states that $x \simeq y$ precisely if $\hom(x,-)$ and $\hom(y,-)$ are naturally isomorphic functors. Moreover, all such natural isomorphisms arise as postcomposition of some arrow.
There is a lot of terminology to unpack, but applying this to spaces gives that if $\mathcal{C}(X_1,Y) \simeq \mathcal{C}(X_2,Y)$ naturally (in the category-theoretical sense) in $Y$, then $X_1$ and $X_2$ are homeomorphic.