On the Linear Ordering of Some Classes of Negacyclic and Cyclic Codes and Their Distance Distributions