When arrested Alex Abrams, 23, told Lancashire Police officers: "I just gave away what I had."
Preston Crown Court heard Abrams and another man, who cannot be named, were spotted by patrolling police officers sitting in a vehicle parked on Northumberland Road at 10.30am on April 4.
Prosecuting, Jeremy Grout-Smith said: " Police officers saw two men approach the driver's side of the vehicle and a hand to hand exchange took place.
"The two men quickly walked away and then a third man appeared and they witnessed a further hand to hand exchange.
"They walked over to detain the driver, who was this defendant, and a front seat passenger.
"The defendant was found in possession of two Kinder eggs containing 21 wraps of heroin and cocaine - six of heroin and 15 of crack cocaine. They also found two mobiles and £250 cash.
The court heard Abrams, of Kenyon Way, Little Hulton, Manchester, told officers: "That phone is my own and the drugs phone is in the car."
He admitted he had drugs in his shorts, but later made no comment in interview.
He has since pleaded guilty to possession with intent to supply class A drugs, and driving offences.
Defending, Bob Elias asked for full credit for his guilty plea due to his 'confession' at the scene.
He added: " His father seems to have been a very poor role model spending most of his life in prison.
"This defendant want to be a good father to his children.
Recorder Kathrine Pierpoint said: " You clearly were involved in drug dealing that day.
"Anyone who spends time in these courts will see the devastating effects that class A drug addiction has. It destroys lives, relationships, causes health problems - even death - and fuels acquisitive crime.
"It's for those reasons the courts deal harshly with those involved in the selling of drugs.
"You know now it's down to you as to whether you can be a good father and put this offending behind you. "