In deciding child custody matters, the court makes its decision largely based on which parent will best look after the interests of the child. If both parents are responsible, loving parents, and both express a desire to see the child as much as possible, the court will probably split custody evenly. An even split reflects the court's judgment that both parents will provide the child with a stable, healthy upbringing.
If, on the other hand, one parent engages in destructive behavior that places the child at risk, the court may limit that parent's custodial time with the child or require that visitations be supervised by a third party. If the parent's behavior is severe enough, the court may eliminate all visits, at least for a period of time, and require that the parent participate in parenting classes or substance abuse therapy.
Unfortunately, some parents have exaggerated or even fabricated stories about their exes in an attempt to restrict their time with the child. One legitimate way to show that a parent is engaging in destructive behavior is to ask the court for a child custody evaluation. This is expensive, but the evaluator has much power to investigate and ferret out the reality of the situation when forming an opinion and recommendation as to custody of the child. You can also ask the court to require testing for substance abuse as a condition to seeing the child. These can be difficult waters to travel but if there is evidence of substance abuse that is harmful to your child you should not hesitate to bring this to the court's attention.