Solomon Walker, 22, was a passenger in an Audi S3 stopped by officers in Leeds city centre on May 7, 2018.
Leeds Crown Court heard police found 20.2g of the Class A drug fentanyl - which is up to 100 times stronger than morphine - contained inside three packages in his jeans pocket.
They also found he was carrying a small amount of cannabis, the knife and £10,415 in cash.
Eddison Flint, his barrister, and Judge Neil Clark both noted the lengthy wait from the time of arrest to his first appearance at Leeds Magistrates' Court on February 7 this year.
Mr Flint said he could not "explain nor understand" it, while the judge said he "had no idea" why it had taken the best part of two years when the offence was admitted from the start.
When he did appear before magistrates, Walker, of Grange View, Chapeltown, had pleaded guilty to possessing a class B drug, criminal property and a bladed article as well as possession of a Class A drug with intent to supply.
Mr Flint told the crown court how his client had been convicted of dangerous driving in March 2019 after a crash which left him with serious injuries that required multiple operations.
He said the "near-death experience" had set Walker on a different path and he now described himself as a "changed man".
He told Judge Clark: "The man Your Honour is sentencing today is not the man responsible for the offences back in 2018.
"He has been working on health issues in the hope that, at some point, he will be rehabilitated health-wise so that he will be able to go on and work."
Walker was now drug-free, had not reoffended since the crash, was "desperate" to start working and had "realised the error of his ways", Mr Flint added.
Sentencing him to two years and eight months in prison, Judge Clark said he had given Walker a shorter jail term in light of the early plea, the crash injuries and the efforts he was making to change his life.
Prosecutor Gareth Henderson-Moore asked the court to use its powers to seize the £10,415 in cash and an additional £585 recovered by police.
An order was also granted for the destruction of the drugs and the knife.