529 funds that are used for “qualifying” purchases aren’t penalized. Qualifying purchases are required expenses from an accredited university. These included tuition, books, supplies, rooms and board.
However, you can use the money for anything. Just keep in mind that if it is a “nonqualified” purchase, you will pay a penalty, usually 10%, and you'll pay some taxes. However, you only pay a tax on the portion of your withdrawal that attributed to gains. You can read up on that more here: https://www.bankrate.com/loans/student-loans/no-escape-from-529-plan-penalty/
Examples of non qualified purchases are: test prep, college application fees, transportation, and even extracurriculars at the university. And unfortunately, Life Quest.