Hi, Al. Usually it's end grain that causes more problems in staining but in both cases the problem is the same. There is too much variation in the roughness of the wood for the stain to be taken onto the wood equally. When you sand, sand all sides with 80 grit, then 100, then 150. You can go on to 220 if you wish, depending on how good you want it to look.
Particularly on the soft woods like pine, use a spit coat or something like Minwax Pre-Stain Wood Conditioner. Pine is well noted for uneven stain absorbtion and these will even out the woods ability to take the stain. A spit coat is 1 part white shellac to 5 parts denatured alcohol. I usually mix this in an old coffee can and apply with a foam brush. If the surface feels slightly rough when it is dry, I usually go over it very lightly with 220 grit paper and tack rag right before staining.