Will 5 days of taking dilaudid at 35 weeks pregnant cause my baby to go through withdrawal?

No. Narcotics are not generally thought to be dangerous for development, especially in the 2nd and 3rd trimesters. Babies in utero can, however, become dependent on such medications. Therefore, the shortest duration of treatment is advised--especially around the timing of delivery. Babies who are exposed to narcotics right before delivery can have (treatable) sleepiness and slow breathing.
Very unlikely. Even at this late stage in your pregnancy, only taking the diluadid for 5 days should not cause any problems or make your baby go through any withdrawal. He or she should be just fine! good luck with the miracle of birth!