For example, if I want to build on sand or gravel. Are there any risks?
Right now I'm digging down until I meet rock and then building a foundation of rock.. I'm paranoid.
The most notable structural difference house materials have are in blast resistance and in fire resistance. Since you are not actually building your house out of sand or gravel, it doesn't matter if the sand or gravel below your house vanishes -- minecraft blocks (with these two exceptions) float.
However, there's something to be said for having less of your house's foundation blow away when your early-morning creepers drop by to say hello.
Because of that, I'd say stone is a suitable foundation material (though if you're careful, it won't mean much in practice)
No, there are no risks whatsoever, with the exception of lava. Even if you unknowingly remove some sand from beneath your structure, the structure will stay where it is, and you can just fill it in again.
Minecraft does not use structural strength (yet), so you could have a 1000km long walkway unsupported anywhere and it will just float there in the air forever.
Notch has suggested that this should be fixed (unsupported blocks should all fall) but if he did this, fixing your house would be the least of the problems that would be encountered.