With regards to the second question, if $Y$ is a $K(\pi,1)$ space then the natural map from $[X,Y]$ to $Hom(\pi_{1}(X),\pi_{1}(Y))$ (divided out by conjugacy) is a bijection (see the answers here https://mathoverflow.net/questions/256118/question-about-maps-of-s3-bundles). But there are examples where quite the opposite occurs, take $X = Y = S^{2}$, both are simply connected but there are infinitely many non-homotopic maps.