At 34 weeks of pregnancy if you were to take a Xanax would the baby have withdrawals or test positive at birth? She doesn’t take it all the time

Better to avoid. There is a risk of neonatal withdrawal symptoms when benzodiazepines (Xanax = alprazolam, a type of benzo) are used during pregnancy. Avoid regular use and use only if there is a clear indication such as seizure control. High doses administered during late pregnancy or labour may cause neonatal hypothermia, hypotonia, and respiratory depression.
Rather than try to. figure out what a woman could or could not get away with - let's just strongly recommend against use of xanax.