I can think of two large differences: prosody, and the more ephemeral nature of music that is listened to versus poetry that is read.
Prosody
Both poetry and lyrics can have meter or not, but with lyrics, the meter always matters. When setting words to music, it will make the words seem "off" or "amateurish" if the meter of the words is not somewhat (or completely) aligned with the meter of the music. (See also this answer on Music.SE)
Generally, all music has a meter that is fixed and repeated. The vast majority of pop and rock songs have a duple meter, which means that each metrical unit is presented in groups of two, four, eight, sixteen, etc. The most popular meter in pop and rock by far is "4/4" time, which we can consider to be four beats grouped together (I don't want to get too distracted by music theory on this Stack).
Those four beats repeat, and each beat lasts for the same amount of time. In each group of four beats, the first one is strong, the second weak, the third slightly less strong than the first, and the fourth is the weakest of all four.
All English prose and poetry has strong and weak syllables. When you set poetry to music, if you set a weak syllable against a strong beat in the musical meter, it will sound strange. If you do that once or maybe twice per stanza (or verse or chorus), you might get away with it and it will even highlight those words in a subtle way. If you are willy-nilly placing verbal emphasis in random places against the musical meter, the whole song will sound strange and even off-putting.
Likewise with other kinds of musical meter - there are duple meters with other numbers of beats than four, like 3/4 and 5/4 time, and there are triple meters (called "compound time" by musicians). Setting words to music is a significant part of the songwriting process.
Prosody, part 2
At this point I will reveal some of my ignorance of poetry, because the following will be about lyrics and might apply to poetry as well, I'm not sure.
In music, what would be called a stanza in written poetry has to be heard. The way we communicate line groupings in music is with rhyme and pauses, because the listener can't see how it's written down. One effect of this is that the way the stanzas are set to music controls how the listener hears them, and even emphasizes certain lines and words.
As we tend to hear duple groups by default, the most basic and popular stanza is four lines. If you write a four line stanza and then a three line stanza, and you give each line the same amount of time in the music, your audience will be waiting with eager anticipation for that eighth line (the missing fourth line of the second stanza). If you want to get the listener to really be paying attention when you go to the chorus, leave out the last line of the verse. Listeners will be emotionally dying to hear the thought completed. Rhyme scheme also enforces the feeling of line groupings, and uncompleted rhymes will have the listener begging for resolution.
On the other end of the spectrum, making the last line of the verse extra long or adding a fifth line will really highlight those "overhanging" words. Your listeners will be thinking about those words when the chorus starts, and won't notice exactly what you sing/say at the beginning of the chorus. Extra words will be more likely remembered by listeners, so put your best words there.
There are so many more little details of prosody when it comes to setting words to music, but I think that is a good introduction to get you started.
Repetition
When reading poetry on a page, the reader can go back and re-read the last line they read as many times as they want before continuing. Or they can re-read the previous stanza. They can read the poem backwards if they want. They can read down the first word of each line. With music, there's no choice. They will hear the words in exactly the order you say them. Anything they missed will have to wait for the next time they listen to the song, unless you sing it again!
Certainly there is repetition in written poetry, but repetition takes on additional importance in music, because everything goes by so quickly, compared to written poetry.
Obviously, choruses are repeated words and music in a song. Usually, the chorus has most of the most important words in a song, and repeating them helps make sure that the listener understands those words when the song is over. Usually we hope listeners will want to listen to a whole song and also listen to it again, so we might put the lyrics in the chorus that we think will "hook" the listener into giving the rest of the song a chance and also make them miss the song later on and want to listen again. Obviously there are musical hooks as well, but lyrical hooks are at least as important.
Even outside of choruses, repetition is huge in music. Music itself is repetition. Three notes together don't mean much until you play the same three note pattern again - perhaps slightly altered. Lyrical repetition inside verses or bridges makes the poetry more musical. For example, it's near-universal in early 20th century Mississippi delta 12 bar blues that the first line of each verse is repeated again with different chords underneath it before the third line is given at the end of the verse.
Further Study
- Songwriting: Writing the lyrics (Coursera course from Berkelee College of Music)
- Study rap if you want to really focus on lyrical and musical meter lining up. If you don't like rap music in general, you might find the cast recording of Hamilton to be a good study of rap lyricism with more historical verbal content.
- Cats (the musical) is poetry set to music. Comparing the original T.S. Eliot book with the setting of the words in the musical would be very instructive.
Case Study: "Mary Had A Little Lamb"
A simple case study. Here's the poem:
Mary had a little lamb
Its fleece was white as snow
And everywhere that Mary went
The lamb was sure to go
As I'm sure you already know, this is changed to make it "more musical" (sorry I don't have a precise definition of that phrase) when it is sung:
Mary had a little lamb (beat)
Little lamb (beat) Little lamb (beat)
Mary had a little lamb its
Fleece was white as snow (beat) (beat) (beat)
Everywhere that Mary went (beat)
Mary went (beat) Mary went (beat)
Everywhere that Mary went the
Lamb was sure to go (beat) (beat) (beat)
Bold syllables are on the musically strong downbeats, and regular syllables are on the musically weak upbeats.
Notice the differences: The lyrical form has gaps to allow the music to "come around again" so that the next strong syllable falls on a strong beat. Repetition is used so the melody can be varied while the words repeat to address the balance between making the lyrics interesting and the melody interesting. The repetition fills time, but also enhances the "musicality" of the words.
Notice particularly that every line has eight beats in the musical version. Since each line of the poem is seven syllables both starting and ending with a strong syllable, an eighth weak beat is added to the end of each line in the lyrical version, with three beats added to the ends of the couplets to let the music fully "come around again" for the next couplet. This reflects how we would pause after each line when reading the poem aloud. The word "and" could optionally be added at the last weak beat at the end of the fourth line of the lyrical version. My recollection is that it's omitted.
Also note how the poem, lyrics, and music are all relatively simple. The poem is essentially trochaic, which along with iambic are the two simplest meters. Contrast with a limerick, which mixes duple and triple metrical feet within a single line.