You’re describing Universal Control. Macs have 2 separate features. Sidecar allows you to use an iPad as an additional display for a Mac. Universal control allows you to use one keyboard/mouse to control multiple Apple devices in proximity. If you use both together, you can use an iPad as a second display for a Mac and use that Mac’s keyboard and mouse just as with any other secondary display.