Work out the lyrics first, and possibly work with another lyricist as a partner, to get the "story/poem" created, possibly for a church worship team, TV drama, theatrical stage production or a movie. Think of Richard Rogers and Oscar Hammerstein -- Jerry Garcia and Robert Hunter -- or Joe Strummer and Mick Jones. Many people find this a much more difficult row to hoe—there's a big difference between poetry and song, and without a solid musical foundation, there are many hurdles to overcome to fit music to the lyrics. Still, when the muse strikes, who really cares if she hits you with the words or the melody first? Grab the inspiration and run with it.
One composer became very well known working with a lyricist: Elton John, putting the lyrics of Bernie Taupin to music. When it's done well, it's very good!