Police spotted Hassan Aurangzeb, 24, and Saleem Hussain, 25, driving around in a Toyota Aygo as they sold drugs to customers who approached their car on Jacobs Well Lane, Berners Street and Peterson Road in Wakefield.
Police moved in to arrest the pair after they stopped in the car park at Halfords on Ings Road in Wakefield on November 17 last year.
Prosecutor, Bashir Ahmed said police discovered more than £900 cash and two Kinder eggs containing eight wraps of heroin and five of crack cocaine worth a total of £170.
Police also seized mobile phones, including one which was linked to a drugs line.
The court heard Aurangzeb was on bail at the time after appearing at Bolton Crown Court last September to face two charges of possessing heroin and crack cocaine with intent to supply.
Hussain was also on bail after being convicted of wounding and affray and was jailed for 33 months for those offences in January of this year.
Aurangzeb, of Briary Close, Wakefield, and Hussain, of Doncaster Road, Wakefield, both admitted two charges of offering to supply drugs; two charges of possession with intent to supply drugs and one charge of possession of criminal property - the cash.
Aurangzeb also admitted two charges of possessing drugs with intent to supply on September 2 in connection with the Bolton Crown Court case.
Nicholas Worsley, mitigating for Hussain, said: “He is well-regarded and liked in the community. He has expressed a desire to turn his life around and be responsible.”
Rukhshanda Hussain, for Aurangzeb, said: “He became involved as he was struggling financially having lost his job.”
Judge Robin Mairs sentenced Hussain to two-and-a-half-years in jail to run consecutive to the 33 month sentence he is currently serving.
Judge Mairs handed Aurangzeb a prison sentence of five-years-and-nine-months.