You are probably thinking of their appearance with Jesus on the Mount of Transfiguration. Both of these worthies of old were long dead with no consciousness until they are raised from the dead at the return of Christ. How then could they appear with Jesus on the Mount? The context of that event provides a straight-forward explanation.
Matthew 17:9 And as they were coming down the mountain, Jesus commanded them, “Tell no one the vision, until the Son of Man is raised from the dead.”
What the disciples saw was a vision much like the visions of John in Revelation. They did not see the real Moses and Elijah. The word vision in Matthew 17:9 is the same word used in Acts 2:17 – dream dreams and see visions; Acts 10:3 – hath seen a vision; Acts 10:17 – this vision which he had seen; Acts 11:5 – I saw a vision; Acts 16:9 – a vision appeared to Paul; Rev. 9:17 – I saw the horses in the vision. These words are all the same in the original Greek as the one in Matthew 17:9.
The other character you mention whose end appears to be enigmatic is Enoch, who was "translated" that he should not see death - probably at the hands of the sons of Cain. That just means that he was taken out of harm's way and transported by the Spirit to another place... like Philip in Acts 8. The same with Elijah - he was transported to another place to save him from Jezebel. However, many years later, he sent a letter to evil Jehoram King of Judah, prophesying his downfall (see 2 Chronicles 21:12). This indicates that not only was Elijah still alive in "retirement" in a secluded place on earth but that he was kept aware of happenings in Judah and Israel. That's the last we hear of him until the Transfiguration. As we pointed out above, there is no problem with the Transfiguration because the Lord himself, in Matt. 17:9, calls what they saw a "vision."
The vision signified the Lord's fulfillment of the Law (represented by Moses)and the prophets (represented by Elijah). In any case, it was a vision and not a tangible reality. Moses and Elijah were/are dead and await the resurrection to share in the glory of the Messiah. It’s interesting that the word “decease” is, in the Greek, “Exodus.” Jesus was about to embark on the journey which would set all of his people free and lead them, as the forerunner or “firstfruits,” to the promised land, the Kingdom of God.
I hope you have found this helpful.
God bless,
Mike