It is related to kidding, but is more like teasing. It is leading someone to believe something is true when it isn’t true in a way that is sometimes mean or deriding. You could also say you’re giving someone a hard time or someone is giving you a hard time. Yanking my chain, taking the piss, taking the mickey are all related.