What kind of bug is this? I got it while washing cabbage.

According to the photos you provided, this worm is a kind of water earthworm, also called red silk worm or red nematode. They usually live in sewage sludge that discharges sewage or waste water, densely on the surface of the sludge, with one end fixed in the sludge and one end sticking out of the sludge to vibrate in the water. These bugs may have been washed out when washing Chinese cabbage.

If you are worried that this kind of bugs will do harm to people, I can tell you that they are harmless to people. However, in terms of food hygiene, it is recommended to clean vegetables before eating them to avoid ingesting any pollutants. You can use some methods to control this insect, such as using pesticides, soaking tobacco, dropping a few drops of essential balm in the water for watering vegetables, etc.

The above information is for reference only. If you have other questions or need more detailed explanation, please consult a professional.