Is ok to post on youtube or vimeo custom resolution videos?
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.