Let one of the lines be described as
#L_1-> a x+b y +c = 0#
now, a parallel to #L_1# can be denoted as
#L_2-> lambda a x+lambda b y + d = 0#
Now equating
#16 x^2 + 24 x y + p y^2 + 24 x + 18 y - 5 =( a x+b y +c)(lambda a x+lambda b y + d)#
after grouping variables we have
#{(c d =-5),
(b d + b c lambda = 18), (b^2 lambda = p),
(a d +a c lambda = 24), (2 a b lambda = 24),
( a^2 lambda = 16):}#
Solving we have a set of solutions but we will focus only one
#a = 4/sqrtlambda,b=3/sqrtlambda,c=(3+sqrt14)/sqrtlambda, d = (3-sqrt14)lambda, p = 9#
so making #lambda = 1#
#((a = 4),(b=3),(c= 3+sqrt14), (d = 3-sqrt14), (p = 9))#
The distance calculus between #L_1# and #L_2# is left as an exercise to the reader.
NOTE:
Considering #p_1 in L_1# and #p_2 in L_2#, the distance between #L_1# and #L_2# can be computed as
#abs(<< p_2-p_1, hat v >>) = d# where #hat v = ({b,-a})/sqrt(a^2+b^2)#