A Research Study to Look Into How Semaglutide, Together With a Lower Dose of Insulin Glargine, Compares to a Higher Dose of Insulin Glargine Alone in People With Type 2 Diabetes (SUSTAIN OPTIMIZE)

This study compares semaglutide, together with a lower dose of insulin glargine, to a higher dose of insulin glargine in participants with type 2 diabetes. The study looks at how well the study medicines control blood glucose levels. Participants will either get semaglutide together with a lower dose of insulin glargine or a higher dose of insulin glargine. The study will last for about 47 weeks (approximately 11 months). Participants will have 9 clinic visits, 15 phone/video calls and 1 home visit. Participants will be asked to wear a sensor that measures their blood sugar all the time in 2 periods of 10 days during the study.


Eligibility Criteria:
Inclusion Criteria:

* Diagnosed with Type 2 Diabetes Mellitus (T2D) mellitus greater than or equal to (\>=) 180 days before screening.
* Glycated haemoglobin (HbA1c) of 7-10 percentage \[(53-86 millimoles per mole (mmol/mol)\] (both inclusive) as assessed by central laboratory on the day of screening.
* Body mass index (BMI) greater than or equal to (\>=) 25 kilograms per meter square (kg/m\^2) on the day of screening.
* Stable daily dose(s) greater than or equal to (\>=) 90 days before screening of any of the following anti-diabetic drugs or combination regimens:
* Any metformin formulations greater than or equal to (\>=) 1500 milligrams (mg) or maximum tolerated or effective dose.
* Any metformin combination formulation greater than or equal to (\>=) 1500 mg or maximum tolerated or effective dose.

The treatment can be with or without sodium glucose cotransporter 2 (SGLT-2) inhibitors.

• Treated with a once daily basal insulin (e.g. insulin glargine Unit 100 or U300, neutral protamine hagedorn (NPH) insulin, insulin detemir, insulin degludec) less than or equal to (\<=) 40 units/day (U/day) for greater than or equal to (\>=) 90 days before screening. Short-term bolus insulin treatment for a maximum of 14 days before screening is allowed.

Exclusion Criteria:

* Uncontrolled and potentially unstable diabetic retinopathy or maculopathy. Verified by a fundus examination performed within the past 90 days before screening or in the period between screening and randomisation. Pharmacological pupil-dilation is a requirement unless using a digital fundus photography camera specified for non-dilated examination.
* Potentially missed diagnosis of Type 1 diabetes (T1D) or latent autoimmune diabetes in adults (LADA) verified by C-peptide less than 0.26 nanomoles per litre (nmol/L) (or 260 picomoles per liter \[pmol/L\] \[0.78 nanograms per millilitre {ng/mL}\]) or antibodies to glutamic acid decarboxylase (anti-GAD) greater than 5 units/millilitre, as measured by the central laboratory at screening.
* Presence or history of pancreatitis (acute or chronic).
* Renal impairment measured as estimated Glomerular Filtration Rate (eGFR) value of less than 30 millilitre per minute per 1.73 meter square at screening as defined by Kidney Disease: Improving Global Outcomes (KDIGO) 2012 classification.
* Any episodes of diabetic ketoacidosis within 90 days before screening.
* Known hypoglycaemic unawareness as indicated by the investigator according to Clarke's questionnaire question 8.