<< Calculus`VectorAnalysis`

Clear[A]
Clear[B]
Clear[V]
Clear[W]
Clear[P]
Clear[Q]
A = {ax, ay, az};
B = {bx, by, bz};
V = {vx, vy, vz};
W = {wx, wy, wz};

P[s_]  :=  A  +  s*V
Q[t_]  :=  
      B  +  t*W

s = ((A . W - B . W) (W . V) + (B . V - A . V) (W . 
                  W))/((V . V) (W . W) - (V . W) (W . 
                  V))

t = ((B . V - A . V) (W . V) + (A . W - B . W) (V . 
                  V))/((W . W) (V . V) - (V . W) (W . 
                  V))

P[s]

Q[t]

(P[s] - Q[t]) . V

Simplify[%]

Cancel[%]

All

Solve[
{U[s, t][[1]]*
              V[[1]] + U[s, t][[2]]*
              V[[2]] + U[s, t][[3]]*V[[3]] == 
          0, U[s, t][[1]]*W[[1]] + U[s, t][[2]]*
              W[[2]] + U[s, t][[3]]*W[[3]] == 
          0},
{s, 
        t}