Deep geothermal energy is of great strategic importance for the development of the energy industry. In the process of geothermal energy extraction, temperature changes will significantly affect the physical and mechanical properties of the rock mass. To investigate the influence of temperature on the physical and mechanical properties of red sandstones and marbles, the uniaxial compression test, variable-angle shear test, mercury intrusion porosimetry (MIP) test, and SEM test were conducted on the red sandstone and marble specimens treated by 9 temperature levels (from 25°C to 800°C). The results show that the porosity is positively correlated with the temperature regardless of rock types. The peak strength of red sandstones during uniaxial compression increases first when temperature increases from 25°C to 400°C and then decreases when temperature increases from 400°C to 800°C, whereas the peak strength of marbles exhibits a first decreasing (from 25°C to 300°C), then increasing (from 300°C to 600°C) and finally decreasing (from 600°C to 800°C) trend. Similarly, the shear strength and cohesion of red sandstones increase first and then decrease as temperature rises from 25°C to 800°C, despite of the predesigned shearing angle, which is opposite to the variation in frictional angle. The variations in physical and mechanical behavior are closely related to the expansion of the constituent grains or groundmass which make up the rock composition and closure of pores. Additionally, the temperature in the range from 400°C to 600°C plays an important role to evaluate the variations in the physical and mechanical characteristics of red sandstones and marbles after high-temperature exposure, because of the stress, strain, and porosity change dramatically.