This is false for spaces.

Let $X = S^0, Y = S^1$