SPUrlUtility offers a host of methods useful for validating URLs. For instance, you can check if a certain character is allowed in a URL (useful for checking common invalid characters such as # % & * { } \ : ? / +), if the URL is relative or full, if the URL uses a supported protocol etc.