Unity already produces contacts so you should use the queries that check for contacts such as the IsTouching calls.
The problem with raycasts or using specific objects for overlap checks are that they are not telling you that your main character is actually touching the ground. They tell you if those specific objects or if the the ray is touching so are always an approximation.
Here’s a video and associated repro that shows you how to do it using a single line of code: https://youtu.be/ZgsrAHGU-mA?si=Q5EGmaOA7r5GkoSG
Hope this helps.