sugar has multiple alcohol functional groups (-OH groups) that cause it to be miscible (can be dissolved) in water. Sands on the other hands does not have this functional group and cannot be dissolved in water. hence you can separate sugar from sand by dissolving the sugar and straining/filtering the sand out