Disturbing sand that hasn't been cleaned for a long time is potentially hazardous as it could release a lot of debris/detritus that has been "sealed" away. This could cause an ammonia spike but don't panic!
During water changes you can vacuum the sand gently. If you carefully control the flow you can prevent sand from being removed while still pulling debris and dirty water out.
I try to give my rock work a good blow off with a small pump prior to every water change to remove settled debris and gently turn over the sand anywhere that my Goby hasn't dug up. Doing this before each change means that at least some of it can be sucked out.
If the sand is particularly dirty you can just focus on one section at a time to minimise the disturbance until everywhere has had a recent clean. Then just remember to give it all a going over regularly if you feel that debris is getting trapped.