I would strongly suggest taking a look at the HC-SR04 ultrasonic sensor. You can find them for about $3 bucks on ebay (a little more from hobby stores) and they work great. I've always thought the Sharp IR sensors were way
To answer your question, yes, there appears to be a big difference between the GP2Y0A21YK0F and the GP2Y0D21YK0F. If you take a look at the datasheets below, you can see that the GP2Y0A21YK0F measures from 10-80cm, while the GP2Y0D21YK0F measures up to 24cm.