To solve this optimization problem, we first need to define the decision variables and the objective function. Let's denote:

- \(x_r\) as the amount invested in real estate,
- \(x_p\) as the amount invested in the pharmaceuticals industry.

The total investment is $300,000, so we have:
\[x_r + x_p = 300,000\]

We are also given that at least 30% of the investment should be in real estate, which translates to:
\[x_r \geq 0.3 \times 300,000\]
\[x_r \geq 90,000\]

And at most 35% of the investment should be in the pharmaceuticals industry:
\[x_p \leq 0.35 \times 300,000\]
\[x_p \leq 105,000\]

The return on investment (ROI) for real estate is 5%, and for the pharmaceuticals industry, it's 10%. The total ROI can be calculated as:
\[ROI = 0.05x_r + 0.10x_p\]

Our goal is to maximize the ROI.

Now, let's translate this problem into Gurobi code in Python:

```python
from gurobipy import *

# Create a model
m = Model("Investment_Optimization")

# Define decision variables
x_r = m.addVar(name="RealEstate_Investment", lb=0)
x_p = m.addVar(name="Pharmaceuticals_Investment", lb=0)

# Objective function: Maximize ROI
m.setObjective(0.05*x_r + 0.10*x_p, GRB.MAXIMIZE)

# Constraints
m.addConstr(x_r + x_p == 300000, name="Total_Investment")
m.addConstr(x_r >= 90000, name="Minimum_RealEstate_Investment")
m.addConstr(x_p <= 105000, name="Maximum_Pharmaceuticals_Investment")

# Optimize the model
m.optimize()

# Print results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Real Estate Investment: {x_r.x}")
    print(f"Pharmaceuticals Investment: {x_p.x}")
    print(f"Maximum ROI: {m.objVal}")
else:
    print("No optimal solution found")

```