Affect and afflict are two different words with different meanings. Afflict is use to explain suffering, to be affected by a disease or pain or distress while the effect is used to influence on, make a difference when something affects another thing.
The word “affect” is more common than word afflicts. An example of afflict. She was afflicted with a disease. An example of effect, the criticism did not affect him, or cancer has affected her lungs. To show effect. I can see her effect on your character; the sentence shows the party character has been affected by her friend’s character.
Affect and Afflict uses different prepositions Afflict uses with and Affect uses by. In some cases, Affect can be used instead of afflicting. Example: The world is afflicted with the coronavirus, or the world has been affected by the coronavirus.