Mercutio's final line before his death is;
Help me into some house, Benvolio,
Or I shall faint. A plague o' both your houses!
They have made worms' meat of me. I have it,
And soundly too. Your houses!
Mercutio is a close friend of Romeo, but he is neither a Capulet nor a Montague. This means he is free to visit with members of both families, and his noble parentage and connections, his wit, and his fighting ability make him a valuable friend. However he is somewhat brash and uncouth at times, perhaps by virtue of his high place going unchecked. In his final scene it is pretty clear that Mercutio is too eager to fight, and only antagonizes Tybalt.
However, as he dies, and the light-hearted aspects of the play die with him, Mercutio realizes that it was neither the Montagues nor the Capulets who were at fault, but both of them; this is the meaning of his famous "plague on both your houses" curse. He finds both families to blame, and it is only in death that he has put aside his bragging and witticism enough to realize that he has basically died for nothing.
"They have made worm's meat of me" means simply that he is going to die, and therefore be "meat" i.e. food, for worms. "I have it, and soundly too" basically means "I'm done for" or "I'm definitely going to die". "Your houses!" is a final curse, meant to accuse Romeo and Tybalt, and to harken the audience to this as a turning point in the play.