In this paper, we study the bifurcation of limit cycles in two special near-Hamiltonian polynomial planer systems which their corresponding Hamiltonian systems have a heteroclinic loop connecting a hyperbolic saddle and a cusp of order two. In these systems, we will compute the asymptotic expansions of corresponding first order Melnikov functions near the loop and the center to analyze the number of limit cycles. Moreover, in the first system, by using the Chebychev criterion, we study the Poincaré bifurcation.