3d and 5d Gauge Theory Partition Functions as q-deformed CFT Correlators