Screw with two grooves?
Those are called breakaway machine screws or just breakaway screws.

They come in handy when installing cabinet hardware (handles/knobs etc.) in materials that differ in thickness or you don't know the thickness. As you have seen, they are also used in many other applications such as bathroom hardware.

The slits in the thread make it easier to adjust the size of the screw to the application without messing up the threads.

Hold the head of the screw in pliers/vise etc. And use another pair of pliers just past the slit on the threads you don't need... Bend the slit up and down and snap.... The piece you don't need breaks off and the thread is still good on the part you need.

You could also just use lineman pliers to cut the screw at the slit of the length you need.

Do you need them? No, you could just match the length and thread type and get that screw. But if you have to cut non breakaway screws, you can mess the thread up and it wont grab the object you are securing. I would personally get the breakaway screws.