A federal judge has sentenced a Whiteville man to 23 years in prison for a drug trafficking conviction stemming from 2020.