If you unsubscribe from Apple Music, you are no longer able to play any streaming music you’ve added or downloaded to your library from the Apple Music catalog.
Songs which you have actually purchased from the iTunes Store will not be affected, plus songs purchased through iTunes can be re-downloaded for free at any time.
Songs you have for example ripped from CDs, and which are not in the Store, and which you have uploaded, will be unaffected by your subscription lapsing.
Any pre-owned songs you have ‘matched’ to the cloud (a setting in the Music/iTunes app - your owned songs will have little clouds next to them if they were uploaded [then deleted locally] for matching) will continue to play if you are paying for ‘iTunes Match’ (which is included in Apple Music) as opposed to ‘Apple Music’. (iTunes Match costs $25/yr and is included with Apple Music.)
So, if you let the Music app upload your personal music so songs can be ‘matched’ and played anywhere (iOS, Macs, Windows, web browsers) and you aren’t intending to pay for the Match service you’ll need to click on the cloud-icon songs to download them back to your computer.
After you’ve downloaded your music you can safely cancel your subscription.
(I have Apple Music but I never utilized music matching because Apple Music changes the metadata for songs if you’d customized them.)
The matching is the only thing you need to worry about - but if you didn’t match your personal library then have no concerns about canceling your subscription.
FYI here’s some info about iTunes Match vs Apple Music: