Path homotopy in contractible space Consider the following statement: 

Let $K,Y,X$ be topological spaces such that $K \subseteq Y$ is a
  subspace and $X$ is contractible. Then any two continuous functions $f,g :Y \rightarrow X$ agreeing on $K$ are homotopic relative to $K$ i.e. there exists a homotopy $H: [0,1] \times Y \rightarrow X$ s.t. $H_0 = f$, $H_1 = g$ and $\forall x \in K, t \in [0,1]: H_t(x) = g(x) = f(x)$. 

In generality that I have written it here, this is too strong and has a counterexample: 
Let $X = Y$ be the closed infinite broom i.e. the subspace of $\mathbb{R}^2$ consisting of the union of all line segments connecting $(0,0)$ and $(1, \frac{1}{n})$ for $n \in \mathbb{N}$ and $[0,1] \times \{0\}$, and let $K := [0,1] \times \{0\}$. Let $f:= \text{id}_{X}$ and let $g: X \rightarrow X$ via $(x,y) \mapsto (x,0)$. Then assume there is a homotopy $H$ between $f$ and $g$ relative to $K$. This implies that $H$ is a strong deformation retract of $[0,1] \times \{0\} \rightarrow X$, which does not exists. (It essentially comes down to the fact that under the stated assumptions $H$ does not preserve $(1, \frac{1}{n}) \rightarrow (1,0)$).
Question:
Is the statement true for $Y = [0,1]$, $K = \{0,1\}$?
If $f,g$ are loops i.e. $f(0) = f(1) = g(0) = g(1)$, then the theorem is true, since every contractible space is simply connected and so $f$ and $g$ are null homotopic.
I have tried the version for paths for the usual pathological examples of contractible spaces i.e. for the closed infinite broom (which I had used for the first counterexample), the comb space and the zig-zag-comb as given in Hatcher (see below), but I could not find a counterexample. 

The zig-zag-comb:
Let $A := [0,1] \times \{0\} \cup \coprod_{q \in \mathbb{Q}} \{q\} \times [0,1]$ and glue countable many copies of $A$ as indicated in the picture below. 

 A: Yes this is true, we can prove this with the help of the fundamental groupoid of a topological space. The fundamental groupoid of $X$ is denoted $\pi_{\leq1}(X)$ and is a category whose objects are points in $X$ and (relative) homotopy classes of paths between points is your set of morphisms, composition is given by multiplication of paths, i.e traversing the first path at double speed and then the second path at double speed. 
The important part about this category is that it is a groupoid, i.e all morphisms (paths) $p(t)$ have a two sided inverse (path) given by $p(1-t)$. It's important to note that $\text{Hom}(x_0,x_0) = \pi_1(X,x_0)$ since both are homotopy classes relative endpoints of paths from $x_0$ to $x_0$. 
Let $x_0,a \in X$ be an arbitrary pair of points then we see that if $p$ is a path from $x_0$ to $a$ (which exists by contractibility of $X$), letting $[-]$ denote homotopy class relative endpoints, $[p]:x_0 \rightarrow a$ by definition. 
We can also see that $[p]$ induces a bijection $[p]_*:\text{Hom}(x_0,x_0) \rightarrow \text{Hom}(x_0,a)$ given by $[f] \mapsto [p] \circ [f]$. This is a bijection since an inverse $[p]^{-1}$ to $[p]$ exists. 
To prove injectivity if $[p] \circ [f] = [p] \circ [g]$ then $[p]^{-1} \circ [p] \circ [f] = [p]^{-1} \circ [p] \circ [g]$ which implies $[f] = [g]$, so $[p]_*$ is injective.
To prove surjectivity if $[q]:x_0 \rightarrow a$ we have that $[p] \circ ([p]^{-1} \ [q]) = [q]$ so $[p]_*$ is surjective. 
Now that we have proved that $\text{Hom}(x_0,x_0) \approx \text{Hom}(x_0,a)$ we recall that $\text{Hom}(x_0,x_0) = \pi_1(X,x_0)$ but since $X$ is contractible $\pi_1(X,x_0)$ is  a one element set. This imples that $\text{Hom}(x_0,a)$ is also a one element set and thus our fact is proven, there is only one homotopy class relative endpoints from $x_0$ to $a$. I.e any two paths which are equal on endpoints have a homotopy between them.
Note that we didn't need that $X$ was contractible, just that it was path and simply connected. 
Hope this helps!
