Unfortunately, I can only give a partial answer. I can show the factorization through dimension $n$ for $\mathbb{RP}^\infty$ or a weaker factorization through dimension $2n$ for $\mathbb{CP}^\infty$.
It is clear that if $X$ factors (up to homotopy) through a CW-complex of dimension $n$, then it actually factors (up to homotopy) through $\mathbb{CP}^{m}\hookrightarrow\mathbb{CP}^\infty$ with $m$ the floor of $n/2$, by cellular approximation.
For now, I can only show that $f$ factors through $\mathbb{CP}^n$. From the classification theorem for vector bundles on paracompact Hausdorff spaces, this follows if we can prove that a complex line bundle on a space of covering dimension $n$ can be generated by $n+1$ global sections, alternatively that there is a trivializing covering by $n+1$ open sets. (The trivializing cover provides an explicit map $X\to\mathbb{CP}^n$ classifying a line bundle isomorphic to the one corresponding to the original map $X\to\mathbb{CP}^\infty$. By the classification theorem the maps are homotopic.)
Now we apply Ostrand's theorem, cf. Theorem 3.2.4 of Engelking's book "Dimension theory", noting that paracompact Hausdorff spaces are normal:
A normal space $X$ has covering dimension $\leq n$ if and only if for every locally finite open cover $\{U_\alpha\}_{\alpha\in I}$ there exists an open cover $\{V_\beta\}$ of $X$ which can be represended as the union of $n+1$ families $\mathcal{V}_1,\dots,\mathcal{V}_{n+1}$ with $\mathcal{V}_i=\{V_{i,\alpha}\}_{\alpha\in I}$ such that $V_{i,\alpha}\cap V_{i,\alpha'}=\emptyset$ and $V_{i,\alpha}\subseteq U_\alpha$ for $\alpha\in I$, $i\in 1,\dots,n+1$.
So, take a trivialization of the line bundle $\mathcal{L}\to X$, and refine the trivializing cover to one satisfying the above property. Then for each $i\in\{1,\dots,n+1\}$, we can define a global section on $\bigcup_{\alpha} V_{i,\alpha}$ by taking non-vanishing sections on the open sets $V_{i,\alpha}$. Using a partition of unity precisely subordinate to our open cover, we can glue the local sections to a global section which is non-vanishing on $\bigcup_{\alpha}V_{i,\alpha}$ and zero outside. (If we assume that $X$ is metric, then we could alternatively scale the section on $\bigcup_{\alpha}V_{i,\alpha}$ with the distance to the boundary to get an extension of the section.)
Applying the above construction to the families $\mathcal{V}_i$ we get $n+1$ global sections generating the line bundle. Hence there is a classifying map $X\to\mathbb{CP}^\infty$, homotopic to the original one, which factors through $\mathbb{CP}^n$.
For what it's worth, let me remark that the proof for covering dimension zero is a lot easier. If the space has covering dimension zero, we can get a trivializing cover by disjoint open sets. Clearly, on such a cover we can define a global non-vanishing section of the line bundle, showing that the classifying map $f:X\to\mathbb{CP}^\infty$ is null-homotopic.
This actually generalizes to show that any map from a space of covering dimension zero to any CW-complex (locally contractible suffices) is null-homotopic. It is however not clear to me how to extend this to positive dimensions - the extension of homotopies from open sets to the whole space, done for sections via the partition of unity, seems to be complicated in general.
Another remark strengthening the 1-dimensional case: if $X$ is of covering dimension 1, the $\mathbb{CP}^n$ argument above shows that it factors through $\mathbb{CP}^1$. Then the composition with the projection $S^2\to\mathbb{RP}^2$ factors through $\mathbb{RP}^1$ by the $\mathbb{RP}^n$-case of the above argument. The projection $S^2\to\mathbb{RP}^2$ is in fact a Hurewicz fibration, so it has the homotopy lifting property for all spaces. We get a homotopy from $X\to\mathbb{CP}^1$ to a map which lands in the preimage of $S^1\subseteq\mathbb{RP}^2$ - but this has to be null-homotopic.
The $\mathbb{CP}^n$-argument can be fixed if we know a variation of Ostrand's theorem, namely that for a normal space of covering dimension $\leq n$ and a locally finite open cover, there exists a refinement given by $n/2$ families of sets $\mathcal{V}_i$ such that the union of the sets in $\mathcal{V}_i$ are of covering dimension 1. But I suppose this is the point where I have give up.