Constantin-Ionel Iamandi of Coombe Road was stopped by officers in Aldershot after they noticed suspicious behaviour linked to a car.
After being searched, the 24-year-old was charged with possession with intent to supply a controlled drug of Class A and using a vehicle without third-party insurance.
He plead guilty to both offences and was jailed for 20 months at Winchester Crown Court on Thursday.