Tiny brown worms in carpeting are usually flea larvae. First, do a thorough vacuuming of the entire carpet. You must throw the vacuum bag out immediately or the fleas will be back . After vacuuming, spray with a flea killer to get any remaining adults, larvae and eggs.