Is ok to post on youtube or vimeo custom resolution videos? I'm having the need of post some screen capture content where some cropping is applied (eg: 850x620) and/or the original monitor resolution is not full hd 1920x1080 but could happen i have to use directly a 1600x900, 1024x768, 1600x1200 and so on.

Uploading videos in h264 but with a video resolution like that will end in a serious quality loss?

What could be a best practice? Give to youtube, vimeo and other services a classic full hd video adding a black frame to match the size or is possible upload a file in native res?

Main goal is keep everything as sharp as possible.
A custom video resolution has no bearing on quality here; only the choice of encoder, bitrate/rate factor and other parameters will impact the final result.

Youtube's player frame on its site is always 16:9, so if your video has an aspect ratio other than 16:9, YT will automatically add black bars as necessary. No need for the uploader to do so. However, if you decide to embed videos hosted on Youtube elsewhere, you can specify a custom frame size in your embed code which matches the aspect ratio of your uploaded video. In which case, your video will be displayed with no black bars. So, best practice is to never manually append black bars.