The crystal structures of the title compounds, viz. C24H14F2N2O2, (I), and C25H17FN2O2, (II), respectively, have been determined in order to unravel the role of an ordered F atom in generating stable supramolecular assemblies. On changing the substitution from fluorine to a methyl group, C-H...F interactions are replaced by C-H...pi interactions, revealing the importance of such weak interactions when present alongside N-H...O and C-H...O hydrogen bonds. The dihedral angle between the planes of the 4-fluorophenyl ring and the pyridine ring is 26.8 (1) degrees in (I), while that between the planes of the 4-methylphenyl and pyridine rings is 29.5 (1) degrees in (II).