Apple Music and iTunes Match offer the same kind of service for your music library. However if you have been using iTunes Match and not Apple Music's iCloud Music Library, then the first thing to do before cancelling would be to make sure that your music is all downloaded to a computer and available offline before cancelling iTunes Match.
Otherwise, if it is not available offline, cancelling iTunes Match, means no more access to that library found in the iTunes Match service.
If you wish to just use Apple Music, you would need to then have Apple Music scan and match / upload your library again.
Note that Apple Music will DRM protect all your songs and tracks even if they were not protected originally. So if you ever cancel Apple Music you will lose access to all DRM protected songs.
Using either iTunes Match or Apple Music it is always a good idea, to have a local backup copy of all your owned songs.
Beyond your own library, songs downloaded from the Apple Music subscription service, that are not part of your library are not really yours and as a such will no longer be accessible if you discontinue the Apple Music subscription.