servo, ping sensor issues with arduino

I was trying to run a servo motor and an infrared sensor but everytime I hooked them both up the timing values I read from the infrared were screwed up. It was only when I hooked up a different power source to run the servo from the arduino when I got it work. I connected the grounds together.