The preparation of hierarchical nanostructures based on metal–organic frameworks (MOFs)-derived transition-metal phosphides (TMPs) have received much attention due to its attractive properties in the application of electrochemical sensors. In this research, a label-free and ultrasensitive electrochemical aptasensor for cortisol detection using MOF-derived Ni-P bundle-like nanorods (Ni-P) was presented as an efficient substrate for loading aptamer strings. Ni-MOF was synthesized using a facile hydrothermal method and, then, the Ni-P was obtained using a simple phosphorization of Ni-MOF precursor in <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">$\text{N}_{{2}}$ </tex-math></inline-formula> atmosphere; it was found that it is made of bundle-like nanorods. The designed aptasensor showed a wide linear sensing range between charge transfer resistance ( <inline-formula xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <tex-math notation="LaTeX">${R}_{\text {ct}}{)}$ </tex-math></inline-formula> and increasing cortisol concentration in the range of 0.1 fM–700 nM with a low detection limit of 10 aM. It is noteworthy that the efficiency of the aptasensor designed by real urine sample was evaluated and the results were compared with the standard enzyme-linked immunosorbent assay (ELISA) method and acceptable results were obtained.