How accurate is the ultrasound sensor when moving? Can I use an ultrasound sensor while the Robot is moving, or will it give bad data?
Short answer: The ultrasonic sensor is perfectly accurate while moving!

A regular NXT robot will move at a maximum speed of several meters per second (usually about 1 or 2 m/s max.). Ultrasound, on the other hand, travels with about 330 meters per second through air. So during the "snapshot" the ultrasound sensor does (basically it sends a ping, listens for the pong-echo, and takes the time difference), your robot appears to be frozen for this brief moment.

So this is why, whenever your ultrasonic sensor makes a measurement, you get a freze-frame snapshot of the current distance to the nearest object it detects. In reality, the sensor sends out pings all the time during default operation, and you just get the very latest measurment -- but essntially, this feels the same.

Since the ultrasonic sensor is digital and offers its data via the I²C protocol, this is where the main latency comes from. On the other hand, you shouldn't poll (i.e. read out) your sensor too frequently, if that is what you're worried about. In several tests we've concluded with hundred NXT kits, that a polling rate of 50 Hz (50 times per second, delay of 20ms between each poll) does work perfectly with no problems at all. When you're using NXT-G, you shouldn't worry at all: You won't get values faster anyway. When you're working with other languages, and you feel your ultrasonic sensor doesn't work so well in a tight loop with constant polling, try to insert this little 20ms break!

Far more important are the objects you try to detect. This is due to the wavelength of ultrasound. You can't detect objects with dimensions of just a couple of centimeters. 


The US works best when facing walls, perpendicular to the sensor
It has big problems detecting furr, carpet- or cloth-like surfaces (the ultrasound doesn't get reflected)
It has big problems detecting smooth surfaces, facing the sensor at skew angles (not 90°) -- the ultrasound gets reflected away
It has problems detecting round objects (e.g. a water bottle or a football) accurately. The ultrasound gets reflected too widely, so you'll see the bottle or ball "bigger and wider" than it is in reality.
It will miss tiny objects 


The first rule is, as always: Experiment on your own! For more resources, try the LEGO NXT Hardware SDK or at least the pictures in this german paper, pages 24, 27ff.