Yes, a custom service is a valid approach if you need a single, controlled API that returns customer details plus related sales orders in one response.
Create an X++ service class with a request contract containing CustomerAccount and a response contract containing customer fields and a list of sales-order details. Expose it as a JSON custom service and call it from the external system using the D365 F&O service endpoint with appropriate authentication.
However, first consider standard OData:
Query CustomersV3 by CustomerAccount for customer details.
Query SalesOrderHeadersV2 filtered by OrderingCustomerAccount or InvoiceCustomerAccount for related orders.
Use OData if the external system can make two or more calls and only needs standard fields. Use a custom service if you need one call, custom validation, calculated fields, pagination, or a combined customer + orders response.
For a custom service, return only required fields, validate the customer exists, handle no-record and permission errors cleanly, and avoid returning large unbounded sales order lists add paging or a date/status filter.