Following is what I do when piecing flannel for a quilt. (I have not do this for a rag quilt, but I haven't made any rag quilts yet.)
This is the only time I prewash and dry, and I do it *twice* because flannel can shrink an incredible amount.
After washing, I starch the flannel heavily to restore body and to stabilize the fabric so it doesn't stretch and distort while cutting and piecing. My method is to mix a 1:1 solution of Sta-Flo liquid laundry starch and water, "paint" it onto the yardage with a large wall-painting brush, toss in dryer, then iron with steam. This makes for very accurate cutting and piecing of flannel. The flannel is about as stiff as thin cardstock (odd, but it works!).
Depending on the pattern and intended usage, I might increase the seam allowance of blocks to 1/2", as flannel can ravel.
As others have mentioned, stop and clean out your machine frequently (especially the bobbin area).