Afflict, which takes the preposition with, means to impose grievous physical or mental suffering on. Inflict, which takes the preposition on, means to mete out or impose (something on someone).
These verbs are easily confused because they’re similar in sound and meaning, but there are clear differences between them. Aside from their different prepositions, they also use objects differently. The direct object of afflict is the person, group, or thing suffering from the affliction (e.g., she afflicted him with great mental distress). The direct object of inflict is the agent of suffering (e.g., he inflicted great mental distress on her).
In the following examples, the writers use afflict well. Note that the direct objects of afflict are the people and things suffering from afflictions:
Ever since the (re)birth of the state of Israel, it has been fashionable to blame this tiny country for all the ills that afflict the Middle East. [Independent]
American housing policy is afflicted with deep political pathologies. [San Francisco Examiner]
Underlying all of this is the fact that police officers are people, with the fallibilities and imperfections that afflict us all. [North Shore News]
Decade after decade, this family has been afflicted with one awful episode after another. [NBC New York]
And in the following examples, inflict is used well. Note that the direct object is the thing that causes suffering:
It gives me no small amount of pleasure to watch the Democratic Party inflict harm upon itself with those “demonstrations” in Wisconsin. [Right Side News]
Musician Carnie Wilson and actress Tracey Gold join the mix as the two inflict unexpected chaos upon each other’s once orderly households. [Entertainment Tonight News]
The home side were 38-0 at the break and rattled up another 28 points in the second half to inflict a heavy defeat on the Saints. [Western Telegraph]
From beneath a self-inflicted avalanche of embarrassment, UCLA has risen. [Los Angeles Times]