You can certainly memorize words, use flashcards, write out words over and over, and do a variety of things to help you memorize words. These and other tricks are particularly good for short-term gains and for taking tests on vocabulary. But like all other parts of language, words are best learned in context. That is, words are best learned by hearing and reading them over and over in various sentences that are part of some kind of communicative intent.
Listening and reading are both particularly good for learning vocabulary. The more you read, the more you will encounter the same words repeatedly in communicative contexts. The same is true for listening. Again, there’s nothing wrong with memorizing and practicing vocabulary—this could prime you for when you encounter words in context. That is, learning words may help you understand them when you encounter them in context. But in the end, you must be engaged with language as communication for you to acquire ability with language.