URLs are not a subset of URIs
You have probably seen or read that URL’s are a subset of URI’s. In theory they are but in practice I have found that not to be the case.
I believe this is most likely because URL’s came before URI. User agents and web frameworks remain backward compatible with old URL’s so be wary of this.
Modern URL’s should be a subset of URI’s. So when constructing a URL its always best to use URI escaping rules when constructing a URL.