TL; DR: 梗 and 迷因 is similar but they have a little difference. Meme can be translated into these two different words depending on the context, and sometimes mixed.
The correct—but uncommon—word for 梗 is 哏, which originally meant a punchline in crosstalk (Xiangsheng). The meaning of 迷因 in Taiwan and the word 'meme' is the same. But some time a picture with meme and words (image macro) called 梗圖 too. (in China, it called 表情包, but the word is also used in Taiwan sometime.) According to the Chinese translation of The Selfish Gene that I have read, the meme was translated as 瀰, but the most common words on internet are 迷因 (Taiwan) and 模因 (China). Possibly because of the closedness of the internet, meme culture in China seens not as popular as Taiwan and other Chinese-speaking places, although 表情包 is very common in China.
If you try google translate, you will find that meme will be translated as 模因 (google translate always uses term of Chinese mainland whenever you choose traditional or simplified Chinese, ironically it has ended their operations in mainland.), but sometimes it will be translated as 梗, and 梗 will also be translated as meme. Simply put, if you can't find a funny place in a picture, you will ask "梗在哪裡？". If your friend sent you a video of never gonna give you up, you'd say "這是個有趣的迷因"
I hope this helps you :)