The meter of "A Dream Within a Dream" is a complicated affair. Every line in the poem (except line 11, which we'll get to) contains three feet (tri = three), and the dominant foot is the iamb. Line 16 is a perfect example:
How few! yet how they creep.
Now, just because the iamb is the most common foot type in this poem does not mean it's the only one. In fact, there are a number of lines that are a bit trickier, such as line 2:
And, in parting from you now.
You will notice that the first beat in the line contains not two but three syllables and is composed of two unstressed syllables followed by a stressed syllable. This is called an anapest. Apparently, Poe was in a rather, um, anapestic mood when he wrote this poem because a number of other lines (such as lines 1 and 24, among others) contain anapests instead of iambs at the beginning.
But wait, you said this poem was written in iambic trimeter? Well, technically it is, but that doesn't mean every single beat has to be an iamb, or that ever line has to be in trimeter. It simply means that most lines have three feet, and most of the feet are iambs. It's a-okay to play it a bit fast and loose with the meter, and to sub in different feet for the sake of variety. And Poe never met an anapest he didn't like.
There are lots of reasons why a poet might want to get messy in metrical matters. Doing the same thing all the time gets really boring, for one, so it's nice to have some variety. Plus, poets will use substitutions for the sake of emphasis. The anapests in this poem stick out like a sore thumb, and we naturally pay more attention when they occur. They also help speed things up, so as we read, Poe can carefully control our speed in subtle ways.
As a whole, this poem changes a lot. The two stanzas are of different lengths (the first is 11 lines, the second 13), there's a bizarre line of iambic tetrameter (11), and anapests are strewn all over the place. These irregularities and shifts give the poem a "dreamy" effect. You might have noticed things change very quickly, and without warning, in dreams, just like they do in this poem.
As far as irregularities go, the two stanzas in this poem also have different rhymes schemes. The scheme for the entire poem is this: AAABBCCDDEE FFGGHHHII. Both stanzas are composed almost entirely of couplets, or two lines in a row that rhyme (they're like little couples). Both stanzas also contain a sequence of three lines in a row that rhyme. But they weirdly occur at different points in each (first three lines in stanza 1, the fifth through seventh in the second 2). These little triplets complement the poem's anapests (a three-syllable foot) and give the poem a nice sense of balance. And before we forget, the changing rhyme scheme also helps give the poem that dreamy effect by slipping in a little weirdness when everything else seems so very regular.