Custom Generated Unique ID Length not Fixed

If I'm reading your expression correctly, you're extracting 20 characters, removing any letters and dashes, and then extracting 10 characters from that string. If your 20 characters have more than 10 letters and dashes, then you won't have enough characters left to take another substring of 10 length.

I recommend considering different methods of creating a unique identifier. Or, if possible, adjust your workflow to generate the unique identifiers after the initial surveys are completed. Here is a discussion on offline generation of unique IDs to ensure no duplicates that may be useful: