Hello Muhammad,
You can check it this way with the help of microflow, use the decision block to check if the password is less than or equal to 5 characters.
Password policy, you can also set in the Security application, but here you have a minimum length to choose from.
If I helped, please accept the answer.
Regards,
Adam