This is part 2 of what was originally shown as a 1-hour Avatar movie special: "The Fury of Aang."
Sokka hallucinates for much of the episodes after drinking juice from a cactus. This may be based on the real hallucinogenic mescaline, which is found in some cacti in the United States and Mexico.