Let vector $\mathbf{v}$ be a unit directional vector. We first rotate it around the $z-axis$ and then around a vector ($\mathbf{u}$) so that the resultant vector is $\mathbf{v'}$.
If the matrices defining the two rotations are $\mathbf{Q_u}$ and $\mathbf{Q_z}$, we can write: $$ \mathbf{v'} = \mathbf{Q_u}.\mathbf{Q_z}.\mathbf{v}$$ If the cross product of $\mathbf{v}$ and $\mathbf{v'}$ is given by $\mathbf{a} = \mathbf{v} \times \mathbf{v'}$, the dot product is $\mathbf{b} = \mathbf{v} . \mathbf{v'}$, and the skew symmetric matrix is $[\mathbf{a}]_{\times}$ , the transformation matrix would be given by: $$\mathbf{Q} = \mathbf{I} + [\mathbf{a}]_{\times} + [\mathbf{a}]_{\times}^2 . \frac{1}{1+\mathbf{b}}$$ where, $Q = Q_u . Q_z$, how do we find the vector $\mathbf{u}$ when only the vectors $\mathbf{v}$ and $\mathbf{v'}$ are known?