If you pay your rent late and your landlord or property manager reports the late rent payments to the credit bureaus then yes it can ding your credit score.
When your credit score is lowered as a result of the late rent payments then it can affect your ability to get approved for a mortgage.
When you apply for a mortgage the lender will check your credit history and if there is late rent payments reported on your credit score and credit report and your credit score is lowered as a result then yes that can cause you to be denied for a mortgage.
So be sure to make your rent payments on time if possible and if you're gonna be late on your rent payments then you should speak with your landlord and work out something with them.
You need to have a credit score of around 650 or above to increase your chances of getting approved for a mortgage.
So make sure to keep your credit report and credit score at a good score.