Whether a lens fits a camera depends on mount. Generally, each camera brand has its own mount (actually, more than one).
Pentax has Kmount for the DSLRs (APSC, FF; for example K-S1, K-70, K-1) and the only Kmount mirrorless camera is the K-01. I like it, I have been using it for years. But it is fairly old technology with some specifics. Modern mirrorless from Sony, Fuji, Oly seem to be much faster. The K-01 image quality is great, but its AF and bust rate are fairly slow. IF those things are important to you, then it might not be the camera for you.
Pentax also has Q series of cameras, which are much smaller and are Q mount. These are also mirrorless. They can take Kmount lenses with adapter.
Most small mirrorless cameras can use an adapter for various other brand lenses, but there might be limitations (for example, no AF at all).
Ultimately, I would recommend you get a K-S1. It is not expensive, it is a full DSLR, with a good viewfinder. Its mirrorless mode is probably the same as the K-01, but the K-S1 is newer technology. And the camera is still super compact, one of the smallest DSLRs ever made with that sensor size. You can check Pentax cameras here (user reviews and in depth forum reviews):
https://www.pentaxforums.com/camerareviews/pentax-k-mount-dslrs-c1.html
Fuji has some great lenses btw, but they tend to cost a lot. But if you want the top notch Pentax lenses, they are not super cheap, either.