The chemical reactions and pathways involving selenocysteine, an essential component of glutathione peroxidase and some other proteins.