The basic difference between them is that affect is chiefly used as a verb. Its main meaning is ‘to influence or make a difference to’, as in the following example sentences, all of which are taken from the Oxford English Corpus:
Research suggests that the neighbourhood you live in can affect how well your children perform at school.
The long periods of separation never affected her love for her mother.
Continuous rain since mid-June has resulted in widespread flooding, affecting over 119 million people.
He is in no doubt that thousands of people will be seriously affected if this proposal becomes a reality.
ffect is used as both a noun and a verb, though the noun use is much more common than the verb. As a noun, effect means ‘a result or an influence’:
It was clear that the strong windy conditions were going to have an immediate effect on the result of the game.
The beneficial effects of exercise are well documented.
Corporations need to think about the long-term effects of their actions.
As a verb, effect means ‘to bring something about as a result’. It’s often used in quite formal contexts, such as written reports, rather than everyday English:
The couple had been separated for two years, but her boyfriend tried to effect a reconciliation.
A Royal Commission appointed in 1906 effected several reforms.
The key thing to remember is that affect is typically used as a verb:
A bout of rheumatic fever in his youth had affected his health throughout his life.
On the other hand, effect is most commonly used as a noun:
Participants were asked to volunteer for a study looking at the effects of stress on their health.