The best explanation for why Mars' and Venus' surface temperatures vary, despite both planets having atmospheres that contain mostly carbon dioxide, is:
Venus has a thick atmosphere which blocks heat from the surface.
Venus' dense atmosphere creates a strong greenhouse effect, trapping heat and resulting in extremely high surface temperatures. In contrast, Mars has a much thinner atmosphere that cannot retain heat effectively, leading to much colder surface temperatures.