Affect is most often used as a verb meaning “to have an impact on, to influence something”, as in “Fear and greed tent to affect one’s judgement”.
Effect is most commonly used as a noun meaning the result or impact of something, an outcome. If there’s “a/an/the” in front of it, it’s an effect. “That experience has had a good effect on him.”
Remember, an action (to affect) has to occur before you can have a result (an effect).