Remove membrane, if necessary, by turning the ribs meat-side down. Use a knife to separate the membrane from the ribs a bit to loosen, then grab it with paper towel to help you grip and peel it off the ribs.
Combine rub ingredients and generously coat the ribs all over with the rub.
Place trivet in the Instant Pot, then add the water or apple juice, vinegar, and liquid smoke. Roll the ribs up and place in the Instant Pot standing on their sides.
Secure the lid and set the valve to sealing. For baby back ribs, cook on HIGH (manual) pressure for 25 minutes. Do a natural pressure release for 10 minutes, then vent to release remaining pressure. For spare ribs, cook on HIGH (manual) pressure for 35 minutes. Do a natural pressure release for 15 minutes, then vent to release remaining pressure.
Set oven to broil or heat grill to high heat. Remove ribs and transfer to a large baking sheet. Brush with the barbecue sauce, then broil or grill for 3-4 minutes until caramelized.