If you want to jump to PyMC V4 there’s a developer guide for new distributions: Implementing a Distribution — PyMC 0+untagged.310.g244c37d.dirty documentation
If you just need something simple you can also use DensityDist, which in V4 also allows for a random method (I don’t recall if it did in V3): pymc.DensityDist — PyMC 0+untagged.310.g244c37d.dirty documentation
Otherwise it is not clear what your problem is from your post alone.