Let $X$ be any space that is not completely regular, and let $p\in X$ and $F\subseteq X$ be a point and a closed set such that $p\notin F$, and there is no continuous function $f:X\to[0,1]$ such that $f(p)=0$ and $f(x)=1$ for each $x\in F$. Then it’s easy to check that there is no continuous function $f:X\to[0,1]$ such that $f(p)=-1$ and $f(x)=1$ for each $x\in F$.
Let $S=\{p\}\cup F$, and let
$$f:S\to[-1,1]:x\mapsto\begin{cases}-1,&\text{if }x=p\\1,&\text{if }x\in F\;;\end{cases}$$
then $f$ is continuous, but it cannot be extended continuously to $X$. And as long as $X$ is $T_1$, $S$ is closed in $X$.
This answer has a nice example, due to John Thomas, of a $T_3$-space $X$ with distinct points $p$ and $q$ such that every continuous $f:X\to[0,1]$ satisfies $f(p)=f(q)$, which is enough: you don’t actually need each continuous $f:X\to[0,1]$ to be constant, though Eric van Douwen showed some years ago that any space like the Thomas example can be used to build a $T_3$-space on which every continuous real-valued function is constant.