Make the threads long and tie a knot, or take a needle and run the end of the threads back up the seam, or you can cut off the end and use some "NO FRAY" or 'FRAY CHECK" on it.
For pillow cases, I usually just tie a knot as close to the end of the seam as I can get, using a stiletto, or a pin and push it down.