They're called “urinal cakes” and are commonly seen at the bottom of urinals. Their purpose? Control bacteria and reduce smell. They're made of para-dichlorobenzene, a chemical that does deodorize but comes with baggage.
What scent is a urinal cake?
Urinal Cakes, Ocean Breeze Scent Urinal Deodorizing Block, Fresh Ocean Scent Urinal Pucks (Case of 12)
Why do people put ice in urinals?
To bartender's surprise, the ice eliminated urinal odors. As one expert explained, the ice froze odor causing molecules in urine, preventing them from being released. Eventually, the odor-filled molecules melt with the ice and drip down the urinal and into the sewer.