Disentanglement and decoherence in two-spin and three-spin systems under dephasing