In American and Canadian English, dike is the preferred spelling of the noun referring to (1) an embankment used to prevent floods, and (2) a low wall dividing lands. Dyke is the preferred spelling in all other main varieties of English.
Dyke is also a derogatory slang word referring to a lesbian. While this sense of dyke has been reappropriated and made positive by some, it is still generally considered offensive and should be shunned outside very specific contexts.
American and Canadian publications use dike for a flood-preventing embankment—for example:
Waves as high as 65 feet (20 meters) broke through the dike in Dailan. [CNN]
Waves are slamming in and splashing over dikes. [Winnipeg Free Press]
The dike, already covered in sandbags, must be built yet another foot higher. [New York Times]
Dyke prevails in all other English-speaking countries—for example:
There’s a sense of finger-in-the-dyke desperation in the attempt to shore up community resilience against unpredictable damage. [Guardian]
Adidas’ response to the subsequent deluge of criticism has mixed unconvincing excuses with an unseemly effort to plug the dyke. [New Zealand Herald]
The flood also breached a dyke at Chokial area under Golaghat circle of the district and submerged 11 villages. [Times of India]