We know that
Velocity of A relative to B is $$ \vec v_{A|B} = \vec v_A - \vec v_B $$ and Acceleration of A relative to B is $$ \vec a_{A|B} = \vec a_A - \vec a_B $$ So, is it correct to do this to find the displacement of A relative to B ?:-
$$ \vec S_{A|B} = (\vec u_A - \vec u_B) t + 0.5 (\vec a_A - \vec a_B) t^2 $$