What does the hammer do?
After completing World 1-4 in the World Tour, I was told that I received a "Hammer". What does it do and how do I use it?
Solution 1:
From this article it looks like hammers are used to remove Thwomps from the Kingdom Builder screen:
Two spots are taken up by Thwomps but those can remove them when you collect a hammer by playing the world tour.
This article states the same thing as above, but also mentions that after getting the Rainbow Bridge you can smash 3 more:
Now that we have achieved the Rainbow Bridge we know that you need to use the hammer three more times to get rid of those ugly square blocks.
IGN seems to confirm this:
In Kingdom Builder mode, you can clear out Thwomps blocking construction by using hammers collected in World Tour and Rally mode. Hammers are earned by completing Worlds and defeating bosses.
To use the hammer:
In the Kingdom Builder menu, you can select these hammers, then tap on a thwomp to get rid of it.
(Source)