You can tweak a existing license to fit your goals. The issue is if it is not widely adopted then it will be a largely uphill battle to enforce said license, and the longer a legal fight the costlier it becomes.
To answer your question: certain software prohibits use for "military technology" which is one of the vaguest term iv seen. You also have license's that prohibit use in a commercial setting etc.
As for a license that prohibits certain users, that's more complex. The WordPress drama which had a button added blocking a specific group did happen, but a judge blocked that action. You probably need any "click to confirm you are not X or don't support Y at the very beginning of the release and not as an add in later down the road.
The easiest method for blocking certain groups of people would be a web developer banning any country IP that supports GDPR, and includes in the terms of service that you will not use the software if you fall into XYZ category.