For projective codimension two surfaces and threefolds whose singular locus is one dimensional, we get the sharp Castehnuovo-Muntford regularity bound in terms of degrees of defining equations and give the classification of nearly extremal Cases. This is a generalization of the result of Bertram et al.