This usually comes after years of use where there is grit in the water. The plastic sliding surfaces get abraded and start to stick. Usually the result is that you have to replace the sprinkler as the tube and piston are both pretty well shot.
You might try unscrewing that black cap, the insides come out and with removing the spray head at the top, you can completely disassemble all the sliding parts. Flush the cup underneath the cap out to remove sediment and touch up all the sliding surfaces with paste wax after completely cleaning them.
Which brings up mineral fouling, if your water has mineral content, soak everything in white vinegar to help the crusts disappear and clean out the filters.
If the wax doesn't add some plasticy glidiness back after reassembly, then replacement is the only option left.
Often irrigation supplies have the filters and nozzels available by the box load, optionally, the internals. Usually, you end up buying the whole shebang, if you stick with only one brand and don't have to deal with freezing, unscrew the top, leave the cup in the ground and replace just the working parts. Acceptable for DIY, professionals don't have time to waste on this and just replace them.
Down on the ranch, we called it
Irritation and it involved moving tarp sticks in ditches and 20' RainBird pipes. At least it didn't have the added misery of suburban irrigation that can be totally halted by fine sediment. Oh, the misery of Drip!
Note: this appears to be a simple spray assembly, if you have rotators, the water motor and other parts are usually getting near life's end when this starts happening so attempting the wax job just postpones the inevitable.