Species identification - greenish blue ocean worm (nudibranch?) in Perhentian Islands, Malaysia
It's hard to identify from the photos provided, but I think it is Chloeia flava (a species of polycaete worm, within the phylum Annelida), also known in English as the "Golden Fireworm".
The size is roughly similar to what you describe (they are typically about 7-10 cm long). The individual you observed looks like it lives in sandy bottom environments (not a typical environment for a nudibranch), and this worm does also. It is commonly found all across the warmer Indo-Pacific as well, and looks like the individual observed in your photo.

If it is not this species, I think it is another species of the same family, Amphinomidae.