In this paper, we have done a comparative study of electronic and magnetic properties of iron phthalocyanine (FePc) and cobalt phthalocyanine (CoPc) molecules physisorbed on monolayer of MoS$_2$ and graphene by using density functional theory. Various different types of physisorption sites have been considered for both surfaces. Our calculations reveal that the $M$Pc molecules prefer the S-top position on MoS$_2$. However, on graphene, FePc molecule prefers the bridge position while CoPc molecule prefers the top position. The $M$Pc molecules are physisorbed strongly on the MoS$_2$ surface than the graphene ($sim$ 2.5 eV higher physisorption energy). Analysis of magnetic properties indicates the presence of strong spin dipole moment opposite to the spin moment and hence a huge reduction of effective spin moment can be observed. Our calculations of magnetic anisotropy energies using both variational approach and $2^{nd}$ order perturbation approach indicate no significant changes after physisorption. In case of FePc, an out-of-plane easy axis and in case of CoPc, an in-plane easy axis can be seen. Calculations of work function indicate a reduction of MoS$_2$ work function $sim$ 1 eV due to physisorption of $M$Pc molecules while it does not change significantly in case of graphene.