In Salesforce, formula fields have an unusual limit.
Rather than enforce a maximum number of characters, it enforces a 15,000 character compile limit. This limits the number of characters the underline SQL statement can contain.
Interestingly enough, this number can change dramatically without you really noticing.
For example, in my tax receipting application, I have a formula field that determines which receipt template to use. The length of this field is only 380 characters, but the compile size is 8,300 characters.
Using AI, I was able to significantly reduce the compile size, but this information definitely shocked me.
The takeaway
When building formula fields, pay attention to the compile size. When reaching the 15,000 limit, use AI to help simplify the logic.