Wiring a switch and a dimmer
The black wire from the /2 cable needs to be pigtailed to the LINE terminals on both devices

We know, from your testing, that the black wire from the /2 cable is the incoming always-hot wire; this means that the black and red wires from the /3 cable are the outgoing switched-hots for the two sets of lights this box controls.  Therefore, we wire the box as follows:


Black from the /2 gets nutted to a black jumper wire, or pigtail (12AWG THHN always works) that goes to the LINE screw on the smart switch and also to the LINE wire (or pigtailed to the LINE screw) from the dimmer
Black from the /3 goes to the LOAD screw on the smart switch
Red from the /3 gets nutted to the LOAD wire (or connected to the LOAD screw) on the dimmer
All the white wires get nutted to each other and to a white pigtail that heads off to the silver neutral screw on the smart-switch (if the dimmer has a silver neutral screw, it needs to be pigtailed to the neutral-junction as well)
And all the ground wires (green and bare) get nutted to each other and to a green or bare pigtail that heads off to the green ground screw on the smart-switch, and to the green ground screw on the smart-dimmer if it has a screw for ground, too


Then you can button the box up, turn the power back on, and enjoy your new smart switch!