Factorization of a nullhomotopic map It is quite easy to show that a map $f:X\to Y$ is nullhomotopic if and only if it extends to a map $CX\to Y$, i.e. $f$ factors as $X\to CX\to Y$ (Show that, if a map $f: X \to Y$ is nullhomotopic then it extends to a map $f_*$ from the cone $CX$ to Y.). I am wondering whether there is a “$Y$-version” of this statement. Precisely, can we construct a space $Z=Z(Y)$ depending only on $Y$ such that a map $f:X\to Y$ is nullhomotopic if and only if it factors as $X\to Z\to Y$?
 A: Yes, at least for path connected $Y$.
Consider the unbased path space $Y^I$, the set of all continuous maps $u : I = [0,1] \to Y$ endowed with the compact-open topology. The map $r : Y^I \to Y,p(u) = u(0)$, is continuous. By a  slight abuse of notation we shall write $r : Z \to Y$ for the restriction of $r$ to any subpace $Z \subset Y^I$.
Now pick $y \in Y$ and let $P(Y,y) = \{ u \in Y^I \mid u(1) = y \}$.  This is a contractible subspace of $Y^I$: Define $H : P(Y,y) \times I \to P(Y,y), H(u,t)(s) = u(s + (1-s)t)$. Then $H_0 = id$ and $H_1$ = constant path at $y$. See also path space is contractible.
Let $Y$ be path connected. Then each nullhomotopic $f : X \to Y$ admits a homotopy $F : X \times I \to Y$ such that $F_0 = f$ and $F_1$ = constant map at $y$. The adjoint map $\hat F : X \to Y^I, \hat F(x)(t) = F(x,t)$, is continuous and we have $\hat F (X) \subset P(Y,y)$. Clearly $r \circ \hat F = f$. Conversely, let $f = r \circ f'$ for some $f' : X \to P(Y,y)$. Since $P(Y,y)$ is contractible, $f$ must be nullhomotopic.
Remark:
We can modify the above construction for spaces $Y$ which are not path connected by picking a point $y_\alpha$ in each path component $P_\alpha$ of $Y$ and defining $P(Y,\{y_\alpha\}) = \bigcup_\alpha P(Y,y_\alpha)$. Thus $P(Y,\{y_\alpha\})$ is the union of disjoint contractible subspaces. The $P(Y,y_\alpha)$ belong to distinct path components of $Y^I$: If the path components of $P(Y,y_\alpha)$ and $P(Y,y_\beta)$ intersect, then there is a path $w$ in $Y^I$ such that $w(0)$ = constant path at $y_\alpha$ and $w(1)$ = constant path at $y_\beta$. But then $r \circ w$ is a path in $Y$ connecting $y_\alpha$ and $y_\beta$, which is possible when $\alpha = \beta$.
Each nullhomotopic $f : X \to Y$ admits a homotopy $F : X \times I \to Y$ such that $F_0 = f$ and $F_1$ = constant map at some $y_\alpha$. The adjoint map $\hat F$  is continuous and we have $\hat F (X) \subset P(Y,y_\alpha) \subset P(Y,\{y_\alpha\})$. Clearly $r \circ \hat F = f$.
What about the converse? So let $f = r \circ f'$ for some $f' : X \to P(Y,\{y_\alpha\})$.
If $X$ is path connected, then $f'(X)$ must be contained in a single path component of $Y^I$, and thus we conclude $f'(X) \subset P(Y,y_\alpha)$ for some $\alpha$. Since the latter is contractible, we see that $f$ is nullhomotopic.
If $X$ is not path connected, then we get a problem. Take $X = \{0,1\}$ and map $i = 0,1$ to distinct $y_{\alpha_i}$. Then $f$ is not null-homotopic, but $f = r \circ f'$ with $f'(i)$ = constant path at $y_{\alpha_i}$.
Moreover, no other $\rho : Z(Y) \to Y$ will do in this case. Let $\alpha_0 \ne \alpha_1$. The map $f : \{0,1\} \to Y,  f(i) = y_{\alpha_i}$ is not nullhomotopic. Pick $z_i \in \rho^{-1}(y_{\alpha_i})$ and define $f'(i) = z_i$. Then $f = \rho \circ f'$.
