I have made a basic first person character controller, and I'm having some trouble with the collision shape in game. I originally used a cylinder because it made it easy to change the height and have the player duck. I didn't really have any issue until I put it into a level with some uneven terrain and noticed the character would get stuck on certain slopes and at weird angles. I've tried to switch it to a capsule shape and that seemed to help with the weird collision on the ground, but now when I change the height of the capsule past a certain point it also changes the radius which is unwanted. I'm wondering if there's any good way to get around this? Which shape is better? I would use a capsule if it didn't limit the height which I could use, but then with cylinder I'm having weird collisions. I've tried messing with different settings, but haven't really found a decent solution. Appreciate if anybody could provide some guidance.

Normal height with capsule:

Height adjusted for player crouching and radius is automatically adjusted (player becomes too small):

Cylinder with correct shape (but gets stuck on uneven terrain):

I guess I'm wondering if there is any way to get a capsule shape which is similar shape to the cylinder in the last picture?

Usually a capsule is used, precisely for this reason. You can use a cylinder, but make the shape of the collision compound by placing a small sphere in the base of the cylinder, which will "lift" the cylinder above the ground, so that it does not cling to irregularities. But it will probably not get rid of stucking completely.