It is well known that Sanatan Dharma is liberal in declaring that there are multiple ways to mukti, not just only one. Hence, there are different kinds of practices observed by followers of different paths. But regardless of whatever path is followed, the body is the priamry asset through which any kind of dharma or penance can be done. Hence, it's said: sariamadya khalu dharma sadhanam (i.e. the protection or maintenance of the body is the foremost duty and then only dharma can be cultivated)
Once the body is taken care of, one may either subject it to pain and penances like walking on burning coal, inserting trishul, etc. or quietly sit and do meditation in peace. What one will do depends upon the nature of the person whether he is svatic, rajasic or tamasic. Those practices which inflict sever pain and difficulty to the body are said to be tamasic and people of that nature do them due to material desires, ego and pride:
aśāstra-vihitaṁ ghoraṁ tapyante ye tapo janāḥ
karṣayantaḥ śarīra-sthaṁ bhūta-grāmam acetasaḥ
māṁ caivāntaḥ śarīra-sthaṁ tān viddhy āsura-niścayān [BG - 17.5,6]
Those who undergo severe austerities and penances not recommended in the scriptures, performing them out of pride and egoism, who are impelled by lust and attachment, who are foolish and who torture the material elements of the body as well as the Supersoul dwelling within, are to be known as demons.
So those severe practices are not actually meant for everyone to do and the purpose is almost always gaining material desires. Only people in tamasic mode of material nature do it and it is not as per the scriptures (aśāstra-vihitaṁ).
However, apart from the severe practices, certain other practices like fasting, pranayam, etc. are done to gain control over the senses and the body so that mind can stay focused in spiritual progress. Those are allowed by scriptures (BG - 4,26,29,30). Also people in the mode of svata perform actions like yanja and worshipping of gods which are quite fine (BG - 17.3,4). Only those severe penances by subjecting the body to pain are of tamasic nature and are not required to be followed.