Why there is a huge difference between the basicity of urea and guanidine?
Urea and guanidine are structurally similar except that the carbonyl oxygen of urea has been replaced by an imine $\ce{NH}$ in guanidine. When it come to protonation, carbonyl oxygen of urea is always protonated over its 2 $\ce{NH2}$ groups (Ref.1 and 2). In guanidine, it is the imine $\ce{NH}$ protonated first. This preference in guanidine is not because a lone pair of $\mathrm{sp^2}$ nitrogen is more basic than that of $\mathrm{sp^3}$ nitrogen (actually it is other way around), but the lone pair of $\mathrm{sp^2}$ nitrogen is the most available pair for protonation over those of two $\mathrm{sp^2}$ nitrogens (lone pairs of two $\mathrm{sp^2}$ nitrogen atoms are contributing to resonance stabilization at the time). However, when protonated, guanidinium ion was highly stabilized by resonance as depicted in the diagram:



Thus, basically, it  comes down to protonation ability of oxygen versus nitrogen. Oxygen is more electronegative than that of nitrogen, thus like to retain its lone pare better than nitrogen (cf. basicity of water and ammonia). Therefore, in that sense alone, guanidine is a better base than urea.

References:


Nanping Wen, Murray H. Brooker, “Urea protonation: Raman and theoretical study,” J. Phys. Chem. 1993, 97(33), 8608-8616 (https://doi.org/10.1021/j100135a013).
B. Valentine, T. E. St. Amour, D. Fiat, “A $\ce{^{17}O}$ NMR study of the protonation of urea,” Organic Magnetic Resonance 1984, 22(11), 697-700 (https://doi.org/10.1002/mrc.1270221105).