Fuzzy numbers (FNs) are used to handle incomplete or unclear data. Ranking FNs is mainly used in decision-making to select the best alternative among the given alternatives and has applications in data analysis, artificial intelligence, and other fields of operations research. This paper introduces a novel technique for ranking generalized trapezoidal fuzzy numbers (GTrFNs) with varying left and right heights using a defuzzification technique based on the volume of the solid of revolution about an axis. For finding the defuzzified value of a fuzzy number (FN), we derive the positive and negative side volumes of the GTrFN with varying left and right heights along with its centroid. A score function is proposed on these volumes and centroid to get the defuzzified value of the FN, and using this value the best alternative is identified among the given. The suggested approach overcomes some of the limitations of existing techniques. As an application, the proposed method is applied to fuzzy risk analysis problems related to identifying the risk of being affected by type 2 diabetes in five persons with different risk-prone parameters.