Sand can get in a well through cracks in the ring joints. Wells need to be cleaned every year or two, and joints need to be sealed.
If the pump is located too deep in the well, sand can be raised from the bottom - in this case, place it higher. Then you need to put a 50 micron mesh filter and a pre-filter (AQUAPHOR Gross or AQUAPHOR Viking with polypropylene cartridges) — they help remove sand, silt, rust and other particles of 5 microns and large. Pre-filters need to be replaced regularly, and mesh filters need to be rinsed so that they won't cause a significant water pressure drop.