It is forbidden to crush snow or ice on Shabbat, as this resembles the Torah prohibition of Sehita – extracting absorbed liquid. Although it is permissible to place an ice cube into a drink, even though it will naturally melt, Halacha forbids actively crushing ice on Shabbat, as a safeguard against the prohibition of Sehita. Therefore, if somebody wants to use leftover ice in his cup for Mayim Aharonim on Shabbat, he may wet his hands with the ice cube, but he may not crush the ice to produce water.
This prohibition does not apply to sugar or sugar cubes. Hacham Ovadia Yosef, in his Hazon Ovadia – Shabbat (vol. 4, pp. 156-159; listen to audio recording for precise citation), explains that crushing sugar differs from crushing ice, in that sugar simply dissolves and does not resemble Sehita. When one crushes ice, water flows from the ice, which is outwardly similar to extracting liquid from fruits, for example. This is not the case regarding sugar, which simply dissolves. Therefore, it is entirely permissible on Shabbat to crush a sugar cube or place it in tea or another drink and to stir the drink to dissolve the sugar, and this does not entail any Shabbat violation.
Summary: It is forbidden to crush ice on Shabbat, but one may put an ice cube in one’s drink. It is permissible to crush sugar cubes on Shabbat, and to dissolve them in a drink by stirring.