Following the answer of Uri Bader, we can show that $Y$ is a retract of the real line, so can be identified with a closed convex subset of $\mathbb R$. Without loss of generality we can assume that $0,1\in Y$ and hence $[0,1]\subset Y$. It follows that the function $C(X,Y)$ is a convex subset of $Y^X\subset \mathbb R^X$ and $C(X,[0,1])\subset C(X,Y)$. The assumption $Y\not\cong\mathbb R\cong C(X,Y)$ implies that $C(X,Y)$ contains a non-constant function $f$. Consider the constant functions $\mathbf 0:X\to\{0\}\subset Y$ and $\mathbf 1:X\to\{1\}\subset Y$ and observe that the set $T=\{\mathbf 0,\mathbf 1,f\}\subset C(X,Y)\subset Y^X\subset\mathbb R^X$ is affinely independent and its convex hull $conv(T)\subset C(X,Y)$ is homeomorphic to the 2-dimensional symplex, which cannot be contained in the real line $\mathbb R\cong C(X,Y)$. This contradiction completes the proof.

The negative answer can also be deduced from the following theorem.
We recall that a topological space $X$ is *functionally Hausdorff* if for any distinct points $x,y\in X$ there exists a continuous function
$f:X\to\mathbb R$ such that $f(x)\ne f(y)$.

**Theorem.** If for non-empty topological spaces $X,Y$ the function space $C(X,Y)$ is functionally Hausdorff and path-connected, then either $C(X,Y)$ is homeomorphic to $Y^n$ for some $n\in\mathbb N$ or $C(X,Y)$ contains a topological copy of the Hilbert cube.

*Proof.* The space $Y\cong C(\{x\},Y)$ is functionally Hausdorff and path-connected, being a retract of the functionally Hausdorff path-connected space $C(X,Y)$. If $Y$ is a singleton, then $C(X,Y)\cong Y^1$ is a singleton, too. So, we assume that $Y$ contains more than one point. In this case $Y$ contains a subspace $I$, homeomorphic to the closed interval $[0,1]$.

Consider the canonical map $\delta:X\to Y^{C(X,Y)}$, $\delta:x\mapsto (f(x))_{f\in C(X,Y)}$. If the image $\delta(X)$ is finite of cardinality $n$, then $C(X,Y)$ is homeomorphic to $Y^n$ (since each function $f\in C(X,Y)$ is constant on each set $\delta^{-1}(y)$, $y\in \delta(X)$).

So, we assume that the set $\delta(X)$ is infinite. Taking into account that the space $Y^{C(X,Y)}$ is functionally Hausdorff, we can construct a continuous map $g:Y^{C(x,Y)}\to I$ such that the image $Z=g(\delta(X))$ is infinite. The surjective continuous map $p:=g\circ\delta:X\to Z$ induces a continuous injective map $p^*:C(Z,I)\to C(X,I)$, $p^*:f\mapsto f\circ p$. It is easy to see that the function space $C(Z,I)\subset I^Z$ contains a topological copy $Q$ of the Hilbert cube $I^\omega$. Then $p^*(Q)$ is a topological copy of the Hilbert cube in $C(X,I)\subset C(X,Y)$.