While the kernels of ripe corn are okay for dogs, the cob itself is a bit more dangerous.
Ingested by a dog, even small pieces of corn cob can tear at and cause damage to the walls of a dog's digestive tract.
Bottom line: served in an appropriate manner, both corn and popcorn are safe for dogs to eat.