The word utopia was first used in this context by Thomas More in his work Utopia; literally it means "nowhere". In this work, More sets out a vision of an ideal society. Other examples include Jonathan Swift's Gulliver's Travels, and B.F. Skinner's Walden Two.
For examples of dystopias, see two of George Orwell's books, Nineteen Eighty-Four and Animal Farm, as well as Aldous Huxley's Brave New World, Ray Bradbury's Fahrenheit 451, Kurt Vonnegut's Harrison Bergeron, and any of William Gibson's novels.
A subgenre of this is ecotopian fiction, where the author posits either a utopian or dystopian world revolving around environmental conservation or destruction. Ernest Callenbach's Ecotopia was the first example of this, followed by Kim Stanley Robinson in his California trilogy. Robinson has also edited a collection of short ecotopian fiction, called Future Primitive: The New Ecotopias.
Another important subgenre are feminist utopias, for example Marge Piercy's novel Woman On the Edge of Time.