how i set the screen resolution for my game to run perfect for every device

i want to configure screen size. to run my game for every device of android because my application rum right on the mobile but when i run in my tablet the application is start lagging

Screen.SetResolution(w,h);
But if you want to have your UI screen independant you got to use anchors or set your canvas scaler