Inflict takes an unpleasant thing as its object and a person as the target: you inflict pain on someone. Afflict takes the person directly as the object: an illness afflicts someone. If the sentence structure is "X inflicted Y on Z", use inflict; if it is "Y afflicts Z", use afflict.
The core difference
Inflict is followed by the unpleasant thing itself, while afflict is followed directly by the person or thing suffering.
- inflict — to cause something unpleasant to be suffered by someone: the storm inflicted serious damage on coastal towns.
- afflict — to cause someone pain, suffering or distress: a condition that has afflicted her for years.
How to tell them apart
Both words trace back to the same Latin root, fligere, meaning "to strike" — inflict adds in- ("against"), while afflict adds ad- ("toward"). That shared root explains why they feel so close in meaning, but the grammar keeps them apart. Inflict wants the unpleasant thing as its direct object, with the sufferer introduced by "on" or "upon": you inflict a punishment on someone. Afflict skips that structure entirely and takes the sufferer as its direct object: an illness afflicts a person.
A quick check is to ask what follows the verb. If it is the bad thing itself (pain, damage, a punishment), the sentence needs inflict. If it is the person or place suffering, it needs afflict.