some people write the lyrics first and then come up with a melody
most people write the melody first and then come up with the lyrics (like Paul McCartney and the famous story of how the melody for "yesterday" came to him in a dream, but he couldn't come up with any lyrics for the longest time, so he would sing it as "scrambled eggs… baby, how I just love your legs")
but even when you conceive the lyrics and melody at the same time, I think it's necessary to note that they are (for the most part) two different processes