The Spanish Habsburgs had a lot of cases of marriages between close relatives, which produced Charles II, with whom the line ended.
There is plenty of experience that shows that it’s a bad idea. My father told me about some people he knew, first cousins who married, and all of their children had birth defects. Of course, things can happen even with couples who are not even distantly related. My wife’s cousin, of Serbian and Irish ancestry, married a Puerto Rican. They had one healthy daughter. The next daughter was born with a rare neuro-muscular disorder, and lived only four months. They wanted another child, and their son was born with the same disorder. He is doing better, but if he survives he will have a severe and lifelong disability. The couple finally had genetic testing and found that they both have a genetic tendancy for that disorder.