The creature you describe may be a sand worm (also known as a sea worm), an arthropod that lives on the beach in the North Sea. Sandworms usually dig caves on the beach and bury themselves in the sand, exposing only the front of their bodies. When they feel threatened, they will quickly shrink back to the cave to protect themselves.
The worm's body is usually light yellow, and they can grow very long. On the beach of Beihai, the sand worm is a common creature. If you are interested in them, you can observe their caves and behaviors carefully on the beach.