This is the way I always remember the difference. The preterite tense is the past. The imperfect tene is the ongoing past. The preterite tense means that an action in the past has finished. For example, you might explain what you did yesterday such as "I went to the park. I ate some paella. I saw a fish in the sea." You are stating what you did. The imperfect tense is used to describe an action in the past that often happens more than once or to describe people, actions and weather, things that change. For example. "John always ran to the shop." "My friend never gave me a present." The words always and never tell you that this action never ended. It happened more than once or a long time ago (we used to go to the park when we were younger). If you are describing people or the weather you would always use 'era' because people change overtime and so does the weather. You are able to use the preterite and the imperfect tense together. For example, "I went to the park with my friend and I kept seeing lots of dogs!" I went (preterite-action ended) kept seeing (imperfect-action was ongoing,).
The preterite and the imprefect tense is a tricky tense to learn and it takes years to master it. You will find that the more spanish you speak, the easier it will become and you will begin to use both tenses naturally without even thinking about it.